Get a defined number of Points.

@param int  $metricId
@param int  $num
@param int  $page

@return array|bool
519430
public function indexPoints($metricId, $num = 1000, $page = 1)
    {
        if ($this->cache != false) {
            return $this->cachePoints($metricId, $num, $page);
        }

        return $this->client->call(
            'GET',
            "metrics/$metricId/points",
            [
                'query' => [
                    'per_page' => $num,
                    'current_page' => $page,
                ],
            ]
        );
    }
981017
protected function calculateLinks($currentPage, $numberOfPages)
    {
        $baseUrl = $this->getBaseUrl();
        $prev = ($currentPage > 1) ? $currentPage - 1 : null;
        $next = ($currentPage < $numberOfPages) ? $currentPage + 1 : null;

        $separator = ($this->paginationLink) ? '/' : '?page=';

        return [
            'current' => $baseUrl.$separator.$currentPage,
            'prev' => ($prev) ? $baseUrl.$separator.$prev : null,
            'next' => ($next) ? $baseUrl.$separator.$next : null,
            'last' => ($numberOfPages > 0) ? $baseUrl.$separator.$numberOfPages : null,
        ];
    }
1297617
public function getPointsSinceMinutes(Metric $metric, $minutes)
    {
        $queryType = $this->getQueryType($metric);

        $points = DB::select("SELECT DATE_FORMAT({$this->getMetricPointsTable()}.`created_at`, '%Y-%m-%d %H:%i') AS `key`, {$queryType} ".
            "FROM {$this->getMetricsTable()} INNER JOIN {$this->getMetricPointsTable()} ON {$this->getMetricsTable()}.id = {$this->getMetricPointsTable()}.metric_id ".
            "WHERE {$this->getMetricsTable()}.id = :metricId ".
            "AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) ".
            "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
            "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
            'metricId' => $metric->id,
            'minutes'  => $minutes,
        ]);

        return $this->mapResults($metric, $points);
    }
495050
public function getPageAction($requestId, $page) {
        $response = $this->loadPage($requestId, $page);
        $response['toolbar'] = $this->container->get('mesd.jasper.reportviewer.linkhelper')->generateToolbarLinks(
            $requestId, $response['page'], $response['totalPages']);

        return new JsonResponse($response);
    }
263264
public function getCountForNextPage($iPage, $iCount)
    {
        if ($iCount < 1) {
            return 0;
        }

        $iPage = (int) trim($iPage);

        //Check page value
        if ($iPage < 1) {
            $iPage = 1;
        }

        //Get max page value
        $iMaxPage = $this->getMaxPage($iCount);
        if ($iMaxPage <= $iPage) {
            return 0;
        }

        $iNextCount = $iCount - $this->iElementOnPage * $iPage;
        if ($iNextCount > $this->iElementOnPage) {
            $iNextCount = $this->iElementOnPage;
        }

        return $iNextCount;
    }
147071
function (page) {
        if (!lang.isNumber(page)) {
            page = this.getCurrentPage();
        }

        var perPage = this.get('rowsPerPage'),
            records = this.get('totalRecords'),
            start, end;

        if (!page || !perPage) {
            return null;
        }

        start = (page - 1) * perPage;
        if (records !== Paginator.VALUE_UNLIMITED) {
            if (start >= records) {
                return null;
            }
            end = Math.min(start + perPage, records) - 1;
        } else {
            end = start + perPage - 1;
        }

        return [start,end];
    }
371452
public function index(Metric $metric, MetricPoint $metricPoint)
    {
        $points = $metric->points()->paginate(Binput::get('per_page', 20));

        return $this->paginator($points, Request::instance());
    }
735821
public function devApplyList($page = 1, $num = 10)
    {
        $url = 'https://api.weixin.qq.com/wxa/plugin?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        $data = ['action' => 'dev_apply_list', 'page' => $page, 'num' => $num];
        return $this->callPostApi($url, $data, true);
    }
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()
1040310
public function cacheGroups($num = 1000, $page = 1)
    {
        if ($this->cached != null) {
            return $this->cached;
        }

        $this->cached = $this->client->call(
            'GET',
            'components/groups',
            [
                'query' => [
                    'per_page' => $num,
                    'current_page' => $page,
                ],
            ]
        );

        return $this->cached;
    }
892299
@RequestMapping(value = "", method = RequestMethod.GET)
	public PagedResources<? extends MetricResource> list(Pageable pageable,
			PagedResourcesAssembler<String> pagedAssembler) {
		List<String> names = new ArrayList<>(repository.list());
		long count = names.size();
		long pageEnd = Math.min(count, pageable.getOffset() + pageable.getPageSize());
		Page fieldValueCounterPage = new PageImpl<>(names.subList(toIntExact(pageable.getOffset()), toIntExact(pageEnd)), pageable, names.size());
		return pagedAssembler.toResource(fieldValueCounterPage, shallowAssembler);
	}
80182
public function findPages($type, $page, $numberPerPage)
    {
        $offset = (($page - 1) * $numberPerPage);

        return $this
            ->createQueryBuilder('p')
            ->where('p.enabled = :enabled')
            ->andWhere('p.type = :type')
            ->orderBy('p.publicationDate', 'DESC')
            ->setParameters([
                'enabled' => true,
                'type' => $type,
            ])
            ->setFirstResult($offset)
            ->setMaxResults($numberPerPage)
            ->getQuery()
            ->getArrayResult();
    }
837968
public function get($page, $pageSize, $websiteId = null, $storeId = null)
    {
        $this
            ->initCollection()
            ->filterMixedParam($websiteId, 'website_id')
            ->filterMixedParam($storeId, 'store_id')
            ->joinAddress('billing')
            ->joinAddress('shipping')
            ->joinSubscriptionStatus()
            ->setPage($page, $pageSize);

        return $this->customersResponseFactory->create()
            ->setCurrentPage($this->customerCollection->getCurPage())
            ->setLastPage($this->customerCollection->getLastPageNumber())
            ->setPageSize($this->customerCollection->getPageSize())
            ->setTotalCount($this->customerCollection->getSize())
            ->setCustomers($this->handleCustomers());
    }
674240
public function getLimit($sql, $page, $num = 0, $params = array(), $next_page = false)
    {
        $num = (int)$num;
        $sql .= ' limit :limit_from,:limit';

        if ($next_page && $num) {
            $limit_from = ($page - 1) * ($num - 1);
        } else {
            $limit_from = ($page - 1) * $num;
        }

        $ret = $this->getAll($sql, array_merge($params, array('limit' => $num, 'limit_from' => $limit_from)));
        return $ret;
    }
1165003
def number_of_pages(self, key, value):
    """"""
    result = maybe_int(force_single_element(value.get('a', '')))
    if result and result > 0:
        return result
635797
public function getData($pageSize, $page)
    {
        $criteria = clone($this->sqlment);
        /* @var Criteria $criteria */
        $criteria->setLimit(($page - 1) * $pageSize);
        $criteria->setOffset($pageSize);
        return $this->db->findAll($criteria);
    }
248452
protected function loadPage($requestId, $page) {
        //Create an array that will be converted into the json response
        $response = array('success' => true, 'output' => '');

        //Load the report
        $rl = $this->container->get('mesd.jasper.report.loader')->getReportLoader();
        try {
            $report = $rl->getCachedReport($requestId, 'html', array('page' => $page));
        } catch(\Exception $e) {
            $response['success'] = false;
            $response['output'] = 'An error occured trying to load the report';
            $response['totalPages'] = 0;
            $response['page'] = 0;
        }

        if ($response['success']) {
            $response['success'] = !$report->getError();
            $response['output'] = $report->getOutput();
            $response['totalPages'] = $report->getTotalPages();
            $response['page'] = $report->getPage();
        }

        //return the response array
        return $response;
    }