Get a list of pages
@param Pagination $pagination
@param array $params
@return array
482149
public static function getItems($pagination, $params = [])
    {
        $pageCount = $pagination->getPageCount();
        if ($pageCount < 2) {
            return [];
        }
        static::$pagination = $pagination;
        $items = [];
        $currentPage = $pagination->getPage();
        static::$params = array_merge(
            static::$defaultParams,
            $params
        );
        // first page
        $firstPageLabel = static::$params['firstPageLabel'] === true ? '1' : static::$params['firstPageLabel'];
        if ($firstPageLabel !== false) {
            $items[] = static::buildPageItem($firstPageLabel, 0, static::$params['firstPageCssClass'], $currentPage <= 0, false);
        }
        // prev page
        if (static::$params['prevPageLabel'] !== false) {
            if (($page = $currentPage - 1) < 0) {
                $page = 0;
            }
            $items[] = static::buildPageItem(static::$params['prevPageLabel'], $page, static::$params['prevPageCssClass'], $currentPage <= 0, false);
        }
        // internal pages
        list($beginPage, $endPage) = static::getPageRange($pagination, static::$params);
        for ($i = $beginPage; $i <= $endPage; ++$i) {
            $items[] = static::buildPageItem($i + 1, $i, null, false, $i == $currentPage);
        }
        // next page
        if (static::$params['nextPageLabel'] !== false) {
            if (($page = $currentPage + 1) >= $pageCount - 1) {
                $page = $pageCount - 1;
            }
            $items[] = static::buildPageItem(static::$params['nextPageLabel'], $page, static::$params['nextPageCssClass'], $currentPage >= $pageCount - 1, false);
        }
        // last page
        $lastPageLabel = static::$params['lastPageLabel'] === true ? $pageCount : static::$params['lastPageLabel'];
        if ($lastPageLabel !== false) {
            $items[] = static::buildPageItem($lastPageLabel, $pageCount - 1, static::$params['lastPageCssClass'], $currentPage >= $pageCount - 1, false);
        }
        return $items;
    }
836991
public function getPaginationData(ServiceManager $sm, $paginator, $data, $routeName, $routeParams, $queryParams) 
	{
		$mainService = $sm->get('neobazaar.service.main');
		return array(
			'data' => $data,
			'paginationData' => Json::decode($mainService->getView()->paginationControl(
				$paginator,
				'Sliding',
				array('pagination/paginatorjson', 'Document'),
				array(
					'route' => $routeName,
					'params' => $routeParams, 
					'query' => $queryParams
				)
			))
		);
	}
797247
public function paginatedList($parameters = [])
    {
        return $this->sendRequest(
            self::METHOD_GET,
            self::$endPoints['list'] . '?' . http_build_query($parameters)
        );
    }
769789
public function page(Request $request, Application $app, Paginator $paginator)
    {
        return array_merge(
            ['pages' => count($paginator)],
            $this->extractViewParameters($request, ['app', 'paginator'])
        );
    }
563727
public function getList($params = array(), ServiceManager $sm) 
	{
		$page = isset($params['page']) ? (int)$params['page'] : 1;
		unset($params['page']);
		
		$params['limit'] = isset($params['limit']) ? (int) $params['limit'] : 30;
		// The eventual presence of 'offset' key has priority over calculated 'page' value
		$params['offset'] = isset($params['offset']) ? (int) $params['offset'] : ($page * $params['limit'] - $params['limit']);
		
		$routeName = 'UserUser/page';
		$routeParams = array('page' => $page);
		
		$paginator = $this->getPaginator($params);
		
		$data = array();
		foreach($paginator as $user) {
			$data[] = $this->get($user, $sm);
		}
		
		unset($params['limit']);
		unset($params['offset']);
		$queryParams = $params;

		$mainService = $sm->get('neobazaar.service.main');
		return array(
			'data' => $data,
			'paginationData' => Json::decode($mainService->getView()->paginationControl(
				$paginator,
				'Sliding',
				array('pagination/paginatorjson', 'Document'),
				array(
					'route' => $routeName,
					'params' => $routeParams, 
					'query' => $queryParams
				)
			))
		);
	}
769156
public function getPaginatorHtml(Pagination $pagination, $routeName = null, $routeParameters = array())
    {
        return $this->templating->render(
            'TadckaPaginatorBundle::pagination.html.twig',
            array(
                'pagination' => $pagination,
                'route_name' => $routeName,
                'route_parameters' => $routeParameters,
                'pagination_class' => $this->paginationClass,
                'pagination_links_class' => $this->paginationLinksClass,
                'pagination_link_class' => $this->paginationLinkClass,
                'max_near_pages' => $this->maxNearPages,
            )
        );
    }
622386
protected function _getPaginationLinks($pagination)
    {
        $links = [
            Link::SELF => null,
            Link::FIRST => null,
            Link::LAST => null,
            Link::PREV => null,
            Link::NEXT => null,
        ];

        if (isset($pagination['self'])) {
            $links[Link::SELF] = new Link($pagination['self'], null, true);
        }

        if (isset($pagination['first'])) {
            $links[Link::FIRST] = new Link($pagination['first'], null, true);
        }

        if (isset($pagination['last'])) {
            $links[Link::LAST] = new Link($pagination['last'], null, true);
        }

        if (isset($pagination['prev'])) {
            $links[Link::PREV] = new Link($pagination['prev'], null, true);
        }

        if (isset($pagination['next'])) {
            $links[Link::NEXT] = new Link($pagination['next'], null, true);
        }

        return $links;
    }
42166
public function fetchAll($paginated = false)
    {
        if ($paginated) {
            $paginatorAdapter   = new DbTableGateway($this->tableGateway);
            $paginator          = new Paginator($paginatorAdapter);

            return $paginator;
        }

        $resultSet = $this->getTableGateway()->select();

        return $resultSet;
    }
1248512
public function FilteredUpdates($pageSize = 20)
    {
        $params = $this->parseParams();

        $items = $this->Updates(
            $params['tag'],
            $params['from'],
            $params['to'],
            $params['year'],
            $params['month']
        );

        // Apply pagination
        $list = PaginatedList::create($items, $this->getRequest());
        $list->setPageLength($pageSize);
        return $list;
    }
1173555
public function getHtmlToutesLesActualites($params = array())
	{
		$html = "<h1>"._("Actualités")."</h1>";

		$d = new dateObject();
		$pagination = new paginationObject();
		$resDernieresActualites = $this->getDernieresActualites(array('sqlFields'=>'0', "returnAsMysqlRes"=>true));
		$nbEnregistrementTotaux = mysql_num_rows($resDernieresActualites);


		$nbEnregistrementsParPage=15;

		$arrayPagination=$pagination->pagination(
				array(
						'nomParamPageCourante'=>'page',
						'nbEnregistrementsParPage'=>$nbEnregistrementsParPage,
						'nbEnregistrementsTotaux'=>$nbEnregistrementTotaux,
						'typeLiens'=>'noformulaire'
				)
		);



		$arrayActus = $this->getDernieresActualites(array("sqlWhere"=>" AND desactive<>'1' ", "sqlLimit"=>"LIMIT ".mysql_real_escape_string($arrayPagination['limitSqlDebut']).", ".$nbEnregistrementsParPage));

		$tab = new tableau();

		foreach ($arrayActus as $indice => $value) {
			if ($value['urlFichier']!='') {
				$url = $value['urlFichier'];
			} else {
				$url = $this->creerUrl('', 'afficherActualite', array('archiIdActualite'=>$value['idActualite']));
			}

			$tab->addValue("<a href='".$url."'>".$d->toFrenchAffichage($value['date'])." ".stripslashes($value['titre'])."</a>");

			if ($value['photoIllustration']!='') {
				list($w, $h) = getimagesize(
						$this->getCheminPhysique()."images/actualites/".
						$value['idActualite']."/".$value['photoIllustration']
				);
				if ($w>$h) {
					$dimension = "width=80";
				} else {
					$dimension = "height=80";
				}

				$tab->addValue(
						"<img src='".$this->urlImages."actualites/".
						$value['idActualite']."/".
						$value['photoIllustration']."' $dimension>"
				);
			} else {
				$tab->addValue("&nbsp;");
			}
		}

		$html.=$arrayPagination['html'];
		$html.=$tab->createHtmlTableFromArray(
				2, 'margin:0;padding:0;', '', '', " border=''"
		);


		return $html;

	}
1030915
public function getPaginationMetaData()
    {
        $pagination = [
            'count' => $this->count,
            'offset' => $this->offset,
            'limit' => $this->limit,
            'next_page_params' => $this->getNextPageParams(),
        ];

        return $pagination;
    }
953717
public final function getPageList($render, $options) {
        $info = Router::getRouter()->getParsedInfo();
        if (is_null($this->countTotal)) {
            $this->countTotal = $info->total;
        }
        if ($this->countTotal > 0) {
            $paging_data = apply_filter('on_render_paging_by_' . $render, [], $info, $options);
            if (empty ($paging_data)) {
                $paging_data = $this->getPageInfo($info, $this->countTotal, $options);
            }

            return $paging_data;
        } else {
            return [];
        }
    }
369612
protected function parseRelationshipParams(array $params): array
    {
        if (empty($params)) {
            return [];
        }
        $parsed = [];
        foreach ($params as $key => $value) {
            # loop through
            if (is_int($key)) {
                $parsed[$key] = '';
                continue;
            }
            if ($key !== 'paginate' || ($key === 'paginate' && !Arr::isAssoc($value))) {
                $key = $key === 'paginate' ? 'limit' : $key;
                $parsed[$key] = implode('|', $value);

            } else {
                $limit = $this->findInArray($value, 'limit', 0, 10);
                $offset = $this->findInArray($value, 'offset', 1, 0);
                $parsed['limit'] = $limit . '|' . $offset;
            }
        }
        return $parsed;
    }
75006
public function index($params = [])
    {
        // Set the filters
        $params = (!empty($params))? $params : $this->app->request->input();

        // Get records
        $this->model->params = $params;
        $result = $this->model->search($params)->get();

        // Get pagination and number of records
        $pagination = array_merge(
            ['records' => $this->model->search($params)->count()],
            $this->model->pagination()
        );

        // Return results
        return [
            'success' => true,
            'paging' => $pagination,
            'data' => $result
        ];
    }
1196367
public function nextPageUrl(Paginator $paginator)
    {
        $nextPage = $this->nextPage($paginator);

        if ($nextPage === null) {
            return;
        }

        return $this->pageUrl($nextPage);
    }
1307453
public function getPages(Paginator $paginator, $pageRange = null)
    {
        $pageRange  = $paginator->getPageRange();
        $pageNumber = $paginator->getCurrentPageNumber();

        $delta = $pageNumber % $pageRange;

        if ($delta == 0) {
            $delta = $pageRange;
        }

        $offset     = $pageNumber - $delta;
        $lowerBound = $offset + 1;
        $upperBound = $offset + $pageRange;

        return $paginator->getPagesInRange($lowerBound, $upperBound);
    }
745515
protected function resolvePerPage($paginate)
    {
        if ($perPage = request($this->perPageName)) {
            if (is_array($paginate)) {
                $paginate['arguments'][0] = (int) $perPage;

                return $paginate['arguments'];
            }

            $this->perPage = (int) $perPage;
        }

        if (isset($paginate['arguments'][0])) {
            return $paginate['arguments'];
        }

        if ($name = $this->grid->getName()) {
            return [$this->perPage, ['*'], "{$name}_page"];
        }

        return [$this->perPage];
    }