Return the number of items on page.

    Args:
        * page = The Page to test for
        * total_items = the total item count

    Returns:
        * Integer - Which represents the calculated number of items on page.
961637
def return_item_count_on_subpage(self, subpage=1, total_items=1):
        
        up_to_subpage = ((subpage - 1) * self.subpage_items)
        #   Number of items up to the page in question

        if total_items > up_to_subpage:
            #   Remove all the items up to the page in question
            #
            count = total_items - up_to_subpage
        else:
            count = total_items

        if count >= self.subpage_items:
            # The remaining items are greater than the items per page
            # so the answer is a full page
            return self.subpage_items
        else:
            #   There are less items than a full page,
            #
            return count
462689
def get_next_page(self, page_num, page_size):
        
        url = self._response_json.get(self.next_page_attr, None)
        if url is None:
            raise StopIteration()
        params, url = self.process_url(page_num, page_size, url)
        response = self.response_handler.api._get(url, raw_response=True, params=params)
        return response.json()
795843
def display_page(page)
    load_page(page)

    puts

    start = (page - 1) * Page::LENGTH + 1
    start.upto(start + Page::LENGTH - 1) do |i|
      puts "#{i} - #{Problem[i].title}" unless i >= Problem.total - 9
    end
  end
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }
283945
def num_pages(self):
        

        if self.count == 0 and not self.allow_empty_first_page:
            return 0

        hits = max(1, self.count - self.orphans)

        return int(ceil(hits / float(self.per_page)))
994675
def has_next_page(self):
        
        return self.current_page < math.ceil(self.total_count / self.per_page)
747855
public final int getTotalPages() {
    if (getTotalItems() < getPageSize()) {
      return 1;
    } else {
      final int remainder = getTotalItems() % getPageSize();
      final int quotient = getTotalItems() / getPageSize();
      return (0 == remainder) ? quotient : (quotient + 1);
    }
  }
719197
def first(self):
        

        if self.total and self.limit < self.total:
            return {'page[offset]': 0, 'page[limit]': self.limit}
        else:
            return None
119554
function (page) {
        if (!lang.isNumber(page) || page < 1) {
            return false;
        }

        var totalPages = this.getTotalPages();

        return (totalPages === Paginator.VALUE_UNLIMITED || totalPages >= page);
    }
946419
public static int totalPage(int totalCount, int pageSize) {
		if (pageSize == 0) {
			return 0;
		}
		return totalCount % pageSize == 0 ? (totalCount / pageSize) : (totalCount / pageSize + 1);
	}
1093537
def get_by_page(query, page, page_size):
    
    pager = Paginator(query, page_size)

    try:
        models = pager.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        models = pager.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        models = pager.page(pager.num_pages)

    return models
869808
private function getPagesCount()
    {
        if ($this->getItemsPerPage() != 0) {
            return (int) abs(ceil($this->getTotalAmount() / $this->getItemsPerPage()));
        } else {
            return 0;
        }
    }
632378
public function getTotalPages()
    {
        if ($this->totalItems > 0 && $this->itemsPerPage > 0) {
            if (($this->totalItems%$this->itemsPerPage) != 0) {
                return (int)($this->totalItems/$this->itemsPerPage) + 1;
            }
            else {
                return (int)($this->totalItems/$this->itemsPerPage);
            }
        }

        return 0;
    }
629228
def paginated_item_list(page_array:)
        Kaminari.paginate_array(page_array, total_count: page_array.size).page(current_page).per(rows_from_params)
      end
1032332
def count(cls, **kwargs):
        
        url = recurly.base_uri() + cls.collection_path
        if kwargs:
            url = '%s?%s' % (url, urlencode_params(kwargs))
        return Page.count_for_url(url)
168237
def page(self):
        
        if not self._page:
            try:
                self._page = self.paginator.page(
                    self.query_dict.get('page', 1))
            except InvalidPage:
                raise HttpError("Invalid page", status=HTTP_400_BAD_REQUEST)
        return self._page
575442
def pages(self):
        """"""
        if self.per_page == 0 or self.total is None:
            pages = 0
        else:
            pages = int(ceil(self.total / float(self.per_page)))
        return pages