This method will return a list of records for a specific page.

@param pageNumber page number to return. This is indexed at 1, not 0. Any value below 1 is illegal and will
be rejected.
@return list of records that match a query make up a "page".
178495
@SuppressWarnings("unchecked")
    public List<Map>  getPage(int pageNumber) {

        if (pageNumber < 1) {
            throw new IllegalArgumentException("minimum page index == 1");
        }

        String select = subQuery == null ?
                dialect.formSelect(tableName, columns, null, orderBys, pageSize, (pageNumber - 1) * pageSize) :
                dialect.formSelect(tableName, columns, subQuery, orderBys, pageSize, (pageNumber - 1) * pageSize);

        currentPage = pageNumber;
        return new DB(dbName).findAll(select, params);
    }
1346199
public GitLabApiForm getQueryParams(int page, int perPage) {
        return (getQueryParams()
                .withParam(Constants.PAGE_PARAM, page)
                .withParam(Constants.PER_PAGE_PARAM, perPage));
    }
767506
private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult)
  {
    Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers();
    Map<String, Integer> newPagingIdentifers = new HashMap<>();

    for (String segmentId : pagingIdentifiers.keySet()) {
      int newOffset = pagingIdentifiers.get(segmentId) + 1;
      newPagingIdentifers.put(segmentId, newOffset);
    }

    return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold));
  }
1239800
public Set<String> getFieldParametersOnPage(Integer pageNumber) {
    Set<String> fieldParameters = parameterPageMap.get(pageNumber);
    if (fieldParameters == null) {
      fieldParameters = new HashSet<String>();
    }
    return fieldParameters;
  }
1203107
public List<Entity> pageForEntityList(Entity where, int page, int numPerPage) throws SQLException {
		return pageForEntityList(where, new Page(page, numPerPage));
	}
1148234
public function getPager($sql, $page, $num = 0, $params = array())
    {
        $ret   = $this->getLimit($sql, $page, $num + 1, $params, true);
        $count = count($ret);
        $count > $num && array_pop($ret);

        return array(
            'rs'   => $ret,
            'next' => $count > $num ? true : false,
        );
    }
1208645
public function getPage($pageNumber)
    {
        if (!\is_numeric($pageNumber)) {
            throw new \InvalidArgumentException(
                'Page number needs to be a number.'
            );
        }

        if ($pageNumber < 1 || $pageNumber > $this->getPageCount()) {
            throw new \InvalidArgumentException(
                \sprintf(
                    'Page number "%s" out of available page range (1 - %s)',
                    $pageNumber,
                    $this->getPageCount()
                )
            );
        }

        $this->readPages();

        $page = $this->pages[$pageNumber - 1];

        if ($page instanceof PdfIndirectObjectReference) {
            $readPages = function ($kids) use (&$readPages) {
                $kids = PdfArray::ensure($kids);

                /** @noinspection LoopWhichDoesNotLoopInspection */
                foreach ($kids->value as $reference) {
                    $reference = PdfIndirectObjectReference::ensure($reference);
                    $object = $this->parser->getIndirectObject($reference->value);
                    $type = PdfDictionary::get($object->value, 'Type');

                    if ($type->value === 'Pages') {
                        return $readPages(PdfDictionary::get($object->value, 'Kids'));
                    }

                    return $object;
                }

                throw new PdfReaderException(
                    'Kids array cannot be empty.',
                    PdfReaderException::KIDS_EMPTY
                );
            };

            $page = $this->parser->getIndirectObject($page->value);
            $dict = PdfType::resolve($page, $this->parser);
            $type = PdfDictionary::get($dict, 'Type');
            if ($type->value === 'Pages') {
                $kids = PdfType::resolve(PdfDictionary::get($dict, 'Kids'), $this->parser);
                $page = $this->pages[$pageNumber - 1] = $readPages($kids);
            } else {
                $this->pages[$pageNumber - 1] = $page;
            }
        }

        return new Page($page, $this->parser);
    }
312857
List<PageEntry> getEntries(int firstIndex, int lastIndex) {
        Preconditions.checkArgument(firstIndex <= lastIndex, "firstIndex must be smaller than or equal to lastIndex.");
        ArrayList<PageEntry> result = new ArrayList<>();
        for (int i = firstIndex; i <= lastIndex; i++) {
            result.add(getEntryAt(i));
        }

        return result;
    }
1091335
def get_page_numbers(current_page, num_pages):
    

    if current_page <= 2:
        start_page = 1
    else:
        start_page = current_page - 2

    if num_pages <= 4:
        end_page = num_pages
    else:
        end_page = start_page + 4
        if end_page > num_pages:
            end_page = num_pages

    pages = []
    if current_page != 1:
        pages.append('first')
        pages.append('previous')
    pages.extend([i for i in range(start_page, end_page + 1)])
    if current_page != num_pages:
        pages.append('next')
        pages.append('last')
    return pages
1283099
public <T> T page(Connection conn, Collection<String> fields, Entity where, int pageNumber, int numPerPage, RsHandler<T> rsh) throws SQLException {
		return page(conn, fields, where, new Page(pageNumber, numPerPage), rsh);
	}
191931
public static <E> Page<E> startPage(int pageNum, int pageSize) {
        return startPage(pageNum, pageSize, DEFAULT_COUNT);
    }
1223391
def list_records(self, domain, limit=None, offset=None):
        
        uri = "/domains/%s/records%s" % (utils.get_id(domain),
                self._get_pagination_qs(limit, offset))
        return self._list_records(uri)
1186070
public static <T> DataPage<T> getByList(List<T> list, int pageSize, int pageNo) {
        List<T> l = subList(list, pageSize, pageNo);
        return new DataPage<T>(l, list.size(), pageSize, pageNo);
    }
961735
def get_pages_from_id_list(id_list):
    '''
    
    '''
    page_list = []
    for id_ in id_list:
        try:
            page_list.append(
                Page.objects.get(id=id_).specific)
        except ObjectDoesNotExist:
            logging.error(
                "Attempted to fetch non-existent"
                " page with id of {}".format(id_))
    return page_list
287677
def page(self, number):
        
        number = self.validate_number(number)
        # remove the extra item(s) when creating the page
        page_items = self.object_list[:self.per_page]
        return FinitePage(page_items, number, self)
1191192
def query_all_pageview(current_page_num=1):
        '''
        
        '''
        return TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url).paginate(
            current_page_num, CMS_CFG['list_num']
        )
1043379
public PaginatedList<User> listFromCurrentCompany(Integer page, Integer pageSize) {

		if (page == null || page < 1) {
			page = 1;
		}
		if (pageSize == null) {
			pageSize = PAGESIZE;
		}
		PaginatedList<User> results = new PaginatedList<User>();
		if (this.domain == null) {
			Criteria criteria = this.dao.newCriteria(User.class).setFirstResult((page - 1) * pageSize)
					.setMaxResults(pageSize).addOrder(Order.asc("name"));
			Criteria counting = this.dao.newCriteria(User.class).setProjection(Projections.countDistinct("id"));
			results.setList(this.dao.findByCriteria(criteria, User.class));
			results.setTotal((Long) counting.uniqueResult());

		} else {
			Criteria criteria = this.dao.newCriteria(CompanyUser.class).setFirstResult((page - 1) * pageSize)
					.setMaxResults(pageSize).add(Restrictions.eq("company", this.domain.getCompany()))
					.createAlias("user", "user", JoinType.INNER_JOIN).addOrder(Order.asc("user.name"));
			Criteria counting = this.dao.newCriteria(CompanyUser.class)
					.add(Restrictions.eq("company", this.domain.getCompany()))
					.createAlias("user", "user", JoinType.INNER_JOIN)
					.setProjection(Projections.countDistinct("user.id"));
			List<CompanyUser> companyUsers = this.dao.findByCriteria(criteria, CompanyUser.class);
			ArrayList<User> users = new ArrayList<User>(companyUsers.size());
			for (CompanyUser companyUser : companyUsers) {
				User user = companyUser.getUser();
				user.setAccessLevel(Math.max(user.getAccessLevel(), companyUser.getAccessLevel()));
				users.add(user);
			}
			results.setList(users);
			results.setTotal((Long) counting.uniqueResult());
		}
		return results;
	}