Get paginator html.

@param Pagination $pagination
@param null|string $routeName
@param array $routeParameters

@return string
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,
            )
        );
    }
24811
public static function createPagination(array $tokens, array $options) {
        if(!isset($options['pagination_as_query']) || !$options['pagination_as_query']) return '';

        $perPageParam = isset($options['per_page_param']) ? $options['per_page_param'] : PaginationQuery::DEFAULT_PER_PAGE_PARAM;
        $pageParam    = isset($options['page_param']) ? $options['page_param'] : PaginationQuery::DEFAULT_PAGE_PARAM;

        $paginationParameters = PaginationQuery::create($tokens, $perPageParam, $pageParam);

        return $paginationParameters ? http_build_query($paginationParameters) : '';
    }
436406
public function generateUrl(string $routeName, array $routeParameters = []): ?string
    {
        foreach ($this->routes as $route) {
            if ($route->getCallback() instanceof self) {
                $url = ($route->getCallback())->generateUrl($routeName, $routeParameters);
                if ($url !== null) {
                    return $url;
                }
            } else {
                if ($route->getName() === $routeName) {
                    return $route->generateUrl($routeParameters);
                }
            }
        }

        return null;
    }
1196367
public function nextPageUrl(Paginator $paginator)
    {
        $nextPage = $this->nextPage($paginator);

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

        return $this->pageUrl($nextPage);
    }
1042038
public function paginator(PaginatorInterface $paginator)
    {
        $currentPage = (int)$paginator->getCurrentPage();
        $lastPage = (int)$paginator->getLastPage();

        $pagination = [
            'total' => (int)$paginator->getTotal(),
            'count' => (int)$paginator->getCount(),
            'per_page' => (int)$paginator->getPerPage(),
            'current_page' => $currentPage,
            'total_pages' => $lastPage,
        ];

        $pagination['links'] = [];

        $pagination['links']['self'] = $paginator->getUrl($currentPage);
        $pagination['links']['first'] = $paginator->getUrl(1);

        if ($currentPage > 1) {
            $pagination['links']['prev'] = $paginator->getUrl($currentPage - 1);
        }

        if ($currentPage < $lastPage) {
            $pagination['links']['next'] = $paginator->getUrl($currentPage + 1);
        }

        $pagination['links']['last'] = $paginator->getUrl($lastPage);

        return ['pagination' => $pagination];
    }
624031
public function paginate(
        \Twig_Environment $twig,
        PaginatorInterface $paginator,
        string $template = '@Core/pagination/default.html.twig'
    ) {
        return $twig->render($template, array(
            'available_pages' => $paginator->getAvailablePages(),
            'current_page' => $paginator->getCurrentPage(),
            'next_url' => $this->getNextUrl($paginator),
            'previous_url' => $this->getPreviousUrl($paginator),
            'route' => $this->getRoute(),
            'params' => $this->getMergedParams(),
        ));
    }
563633
public function getByUser($userId, $paginate = null)
    {
        $query = $this->model->where('user_id', $userId);

        if (!is_null($paginate)) {
            return $query->paginate($paginate);
        }

        return $query->get();
    }
776649
public function getPaginationPath($route, $page, $extraParams = array())
    {
        $params = array(
            $this->getActionParameterName() => $this->getPageActionParameterName(),
            $this->getDatagridParameterName() => $this->getName(),
            $this->getPageParameterName() => $page,
        );
        return $this->container->get('router')->generate($route, array_merge($params, $extraParams));
    }
838852
private function getNextUrl(PaginatorInterface $paginator) : ?string
    {
        $page = $paginator->getCurrentPage();

        if (++$page <= $paginator->getAvailablePages()) {
            return $this->generateUrl(
                $this->getRoute(),
                $this->getMergedParams(['page' => $page])
            );
        }

        return null;
    }
540857
final public function urlFor($routeName, array $params = array())
    {
        if (null === $this->router) {
            return '';
        }

        return $this->router->urlFor($routeName, $params);
    }
1160198
public function pagination($paginator, $config = array())
    {
        if (!$paginator) {
            return '';
        }

        $config = new AnConfig($config);

        $config->append(array(
            'url' => (string) $this->_template->getView()->getRoute(),
            'force' => false,
            'options' => array(
                'limit' => 20,
            ),
        ));

        if (is($paginator, 'AnDomainEntitysetDefault')) {
            $entityset = $paginator;
            $paginator = new AnConfigPaginator(array(
                'offset' => $entityset->getOffset(),
                'limit' => 20,
            ));

            $paginator->total = $entityset->getTotal();
        }

        if (!$paginator instanceof AnConfigPaginator) {
            $paginator = new AnConfigPaginator($paginator);
        }

        $paginator->display = 5;

        //if our total is less than the limit don't show paginator
        if ($paginator->total < $paginator->limit) {
            return;
        }

        $config->paginator = $paginator;

        //convert url to the httpurl object
        $config->url = $this->getService('anahita:http.url', array('url' => $config->url));

        $pages = array();

        foreach ($paginator->pages->offsets as $offset) {
            $page = array();
            $url = clone $config->url;
            $query = array_merge($url->getQuery(true), array('limit' => $offset->limit, 'start' => $offset->offset));

            $url->setQuery($query);

            $page['number'] = $offset->page;
            $page['current'] = $offset->current;
            $page['url'] = (string) $url;

            $pages[] = $page;
        }

        $config['pages'] = $pages;
        $config['total'] = $paginator->total;
        $pages = array('prev','next');

        foreach ($pages as $page) {
            if ($paginator->pages->$page) {
                $url = clone $config->url;
                $query = array_merge($url->getQuery(true), array('limit' => $paginator->pages->$page->limit, 'start' => $paginator->pages->$page->offset));

                $url->setQuery($query);
                $config->{$page.'_page'} = (string) $url;
            }
        }

        return $this->_render('pagination', $config);
    }
654552
public function renderPaginateSelect(\Twig_Environment $twig, Pagerfanta $paginator, array $limitOptions = [], array $options = [])
    {
        $parameterName = $this->parameters->get('parameter_name');
        if (false !== $this->parameters->get('paginate') &&
            isset($parameterName['paginate'])) {
            $options = $this->getOptions($options, $this->paginateTemplate);
            $paginateName = $this->getParameterName('paginate');
            $limitOptions = !empty($limitOptions) ? $limitOptions : $this->parameters->get('allowed_paginate');

            $limits = [];
            foreach ($limitOptions as $limit) {
                $routeParams = $this->getRouteParams(
                    [$paginateName => $limit],
                    $options['route_params']
                );

                if (array_key_exists('page', $routeParams)) {
                    $routeParams['page'] = 1;
                }

                $limits[$limit] = $this->router->generate(
                    $this->getRouteName($options['route']),
                    $routeParams
                );
            }

            return $twig->render($options['template'], [
                'paginator' => $paginator,
                'limits' => $limits,
            ]);
        }

        return '';
    }
225842
public function getPaginationView(Paginator $paginator, $view = null)
	{
		$data = array('environment' => $this, 'paginator' => $paginator);

		return $this->view->make($this->getViewName($view), $data);
	}
442206
protected function pagePaginationLinks(
        $route,
        $pageNumber,
        $pageSize,
        $totalPages,
        Fields $fields,
        Sorting $sorting,
        Included $included,
        $filters
    ) {
        $next = $pageNumber + 1;
        $previous = $pageNumber - 1;
        $last = ($pageSize == 0) ? 0 : ceil($totalPages / $pageSize);

        $links = array_filter(
            [
                'self' => $pageNumber,
                'first' => 1,
                'next' => ($next <= $last) ? $next : null,
                'previous' => ($previous >= 1) ? $previous : null,
                'last' => $last,
            ]
        );

        foreach ($links as &$numberedLink) {
            $numberedLink = $this->pagePaginatedRoute(
                $route,
                $numberedLink,
                $pageSize,
                $fields,
                $sorting,
                $included,
                $filters
            );
        }

        return $links;
    }
494306
public function getList(Pagination $pagination = null, Filters $filters = null, $qParam = '')
    {
        $orderList = new OrdersList($this->moip);

        return $orderList->get($pagination, $filters, $qParam);
    }
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;
    }
674185
public function getPageName($routeName)
    {
        if (isset($this->routePageMap[$routeName])) {
            return $this->routePageMap[$routeName];
        }

        throw new NotFoundRouteNameException(sprintf('Not found route with name \'%s\'', $routeName));
    }