// Page will return the Page (of Kind taxonomyList) that represents this set
// of pages. This method will panic if p is empty, as that should never happen.
191758
func (p WeightedPages) Page() Page {
	if len(p) == 0 {
		panic("WeightedPages is empty")
	}

	first := p[0]

	// TODO(bep) fix tests
	if first.owner == nil {
		return nil
	}

	return first.owner.Page
}
1032117
func (p *Pager) URL() template.HTML {
	return template.HTML(p.paginationURLFactory(p.PageNumber()))
}
560975
func (l *ListMetricsOptions) AdvancePage(next *PaginationMeta) ListMetricsOptions {
	return ListMetricsOptions{
		PaginationMeta: next,
		Name:           l.Name,
	}
}
1271830
func (r *PaginationResult) NextPage() *Pagination {
	if r.PageNumber*r.PageSize >= r.TotalCount {
		return nil
	}
	return &Pagination{PageNumber: r.PageNumber + 1, PageSize: r.PageSize}
}
153053
func listingPage(q url.Values) (start string, limit int) {
	// if limit is not a valid integer (or blank string),
	// ignore the error and use the returned 0 value
	limit, _ = strconv.Atoi(q.Get("limit"))
	return q.Get("start"), limit
}
868123
func (s *IPRoleList) PreviousPage() (*IPRoleList, error) {
	if !s.HasPreviousPage() {
		return nil, Error{"No previous page"}
	}

	return s.getPage(s.Meta.NextPageUri)
}
546228
func (r *PaginationResult) NextPage() *common.Pagination {
	if r.PageNumber*r.PageRecordCount >= r.TotalRecordCount {
		return nil
	}
	return &common.Pagination{PageNumber: r.PageNumber + 1, PageSize: r.PageRecordCount}
}
723792
func (p *Pager) Pages() Pages {
	if len(p.paginatedElements) == 0 {
		return paginatorEmptyPages
	}

	if pages, ok := p.element().(Pages); ok {
		return pages
	}

	return paginatorEmptyPages
}
1114044
func (r *Response) PageSlice() []Page {
	pl := []Page{}
	for _, page := range r.Query.Pages {
		pl = append(pl, page)
	}
	return pl
}
1180697
func (self *SimplePageMapper) ErrorPage(conn OauthConnector, errorText string) string {
	v := url.Values{
		"service": []string{conn.Name()},
		"error":   []string{errorText},
	}
	return fmt.Sprintf("%s?%s", self.errorPage, v.Encode())
}
1322917
func (g *PagesService) PageInfo(uri *Hyperlink, uriParams M) (page *PageInfo,
	result *Result) {
	url, err := ExpandWithDefault(uri, &PagesURL, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}
	result = g.client.get(url, &page)
	return
}
1308803
func (c *Client) Page(msg *Page) error {
	if msg.UserId == "" && msg.AnonymousId == "" {
		return errors.New("You must pass either an 'anonymousId' or 'userId'.")
	}

	msg.Type = "page"
	c.queue(msg)

	return nil
}
364497
func (p *page) leafPageElement(index uint16) *leafPageElement {
	n := &((*[0x7FFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
	return n
}
718395
func (s *IPUserList) LastPage() (*IPUserList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
634687
func (p Pages) Limit(n int) Pages {
	if len(p) > n {
		return p[0:n]
	}
	return p
}
264846
func (p Pages) Next(cur Page) Page {
	for x, c := range p {
		if c.Eq(cur) {
			if x < len(p)-1 {
				return p[x+1]
			}
			// TODO(bep) consider return nil here to get it line with the other Nexts
			return p[0]
		}
	}
	return nil
}
541709
func (c *IPMessageList) LastPage() (*IPMessageList, error) {
	return c.getPage(c.Meta.LastPageUri)
}