// TotalPage returns number of total pages.
554038
func (p *Paginater) TotalPages() int {
	if p.total == 0 {
		return 1
	}
	if p.total%p.pagingNum == 0 {
		return p.total / p.pagingNum
	}
	return p.total/p.pagingNum + 1
}
874229
func (p *PaginationResponseMeta) nextPage(originalQuery *PaginationMeta) (next *PaginationMeta) {
	nextOffset := p.Offset + p.Length

	if nextOffset >= p.Found {
		return nil
	}

	next = &PaginationMeta{}
	next.Offset = nextOffset
	next.Length = p.Length

	if originalQuery != nil {
		next.OrderBy = originalQuery.OrderBy
		next.Sort = originalQuery.Sort
	}

	return next
}
477343
func (c CPUMap) Total() int {
	var count int
	for _, value := range c {
		count += value
	}
	return count
}
788498
func (l Links) LastPage() (int, error) {
	if l.Last == "" {
		return l.CurrentPage()
	}
	return pageForURL(l.Last)
}
106081
func (p *WebPage) Pages() ([]*WebPage, error) {
	var resp struct {
		Refs []refJSON `json:"refs"`
	}
	if err := p.ref.process.doJSON("POST", "/webpage/Pages", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
		return nil, err
	}

	// Convert reference IDs to web pages.
	a := make([]*WebPage, len(resp.Refs))
	for i, ref := range resp.Refs {
		a[i] = &WebPage{ref: newRef(p.ref.process, ref.ID)}
	}
	return a, nil
}
1030845
func mainPage(w *rest.ResponseWriter, r *rest.Request) {
	noCache(w)
	http.ServeFile(
		w.ResponseWriter,
		r.Request,
		staticRoot()+"/index.html")
}
1020694
func (t *FpdfTpl) FromPage(page int) (Template, error) {
	// pages start at 1
	if page == 0 {
		return nil, errors.New("Pages start at 1 No template will have a page 0")
	}

	if page > t.NumPages() {
		return nil, fmt.Errorf("The template does not have a page %d", page)
	}
	// if it is already pointing to the correct page
	// there is no need to create a new template
	if t.page == page {
		return t, nil
	}

	t2 := *t
	t2.page = page
	return &t2, nil
}
541709
func (c *IPMessageList) LastPage() (*IPMessageList, error) {
	return c.getPage(c.Meta.LastPageUri)
}
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }
407333
func (p *Pages) ShowPage(name string) *Pages {
	for _, page := range p.pages {
		if page.Name == name {
			page.Visible = true
			if p.changed != nil {
				p.changed()
			}
			break
		}
	}
	if p.HasFocus() {
		p.Focus(p.setFocus)
	}
	return p
}
129360
func (s *IPServiceList) FirstPage() (*IPServiceList, error) {
	return s.getPage(s.Meta.FirstPageUri)
}
1264682
func HugePageLimits(resourceList v1.ResourceList) map[int64]int64 {
	hugePageLimits := map[int64]int64{}
	for k, v := range resourceList {
		if v1helper.IsHugePageResourceName(k) {
			pageSize, _ := v1helper.HugePageSizeFromResourceName(k)
			if value, exists := hugePageLimits[pageSize.Value()]; exists {
				hugePageLimits[pageSize.Value()] = value + v.Value()
			} else {
				hugePageLimits[pageSize.Value()] = v.Value()
			}
		}
	}
	return hugePageLimits
}
588763
func (s *IPCredentialList) LastPage() (*IPCredentialList, error) {
	return s.getPage(s.Meta.LastPageUri)
}
1298865
func (l PermalinkExpander) pageToPermalinkSlugElseTitle(p Page, a string) (string, error) {
	if p.Slug() != "" {
		return l.ps.URLize(p.Slug()), nil
	}
	return l.pageToPermalinkTitle(p, a)
}
157575
func ExtractPage(opts ...interface{}) *opt.PageOption {
	for _, o := range opts {
		if v, ok := o.(*opt.PageOption); ok {
			return v
		}
	}
	return nil
}
486118
func (p *Pages) RemovePage(name string) *Pages {
	var isVisible bool
	hasFocus := p.HasFocus()
	for index, page := range p.pages {
		if page.Name == name {
			isVisible = page.Visible
			p.pages = append(p.pages[:index], p.pages[index+1:]...)
			if page.Visible && p.changed != nil {
				p.changed()
			}
			break
		}
	}
	if isVisible {
		for index, page := range p.pages {
			if index < len(p.pages)-1 {
				if page.Visible {
					break // There is a remaining visible page.
				}
			} else {
				page.Visible = true // We need at least one visible page.
			}
		}
	}
	if hasFocus {
		p.Focus(p.setFocus)
	}
	return p
}
169742
func (p *imageProgress) totalBytes() int64 {
	var b int64
	for _, l := range p.layers {
		b += l.totalBytes
	}
	return b
}