Pagination links.

@param {Object} Paginator object
@return {String}
770228
function(paginator) {
    var template = '';
    template += '.pages\n';
    template += '  - if (paginator.previousPage)\n';
    template += '    span.prev_next\n';
    template += '      - if (paginator.previousPage === 1)\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/") Previous\n';
    template += '      - else\n';
    template += '        span &larr;\n';
    template += '        a.previous(href="/page" + paginator.previousPage + "/") Previous\n';
    template += '  - if (paginator.pages > 1)\n';
    template += '    span.prev_next\n';
    template += '      - for (var i = 1; i <= paginator.pages; i++)\n';
    template += '        - if (i === paginator.page)\n';
    template += '          strong.page #{i}\n';
    template += '        - else if (i !== 1)\n';
    template += '          a.page(href="/page" + i + "/") #{i}\n';
    template += '        - else\n';
    template += '          a.page(href="/") 1\n';
    template += '      - if (paginator.nextPage <= paginator.pages)\n';
    template += '        a.next(href="/page" + paginator.nextPage + "/") Next\n';
    template += '        span &rarr;\n';
    return helpers.render(template, { locals: { paginator: paginator } });
  }
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];
    }
1289871
public function generateItems()
    {
        // Iterator for pagination pages.
        $j = 1;

        foreach ($this->getLinks() as $index => $link) {
            // Create new pagination item
            $item = new PaginationItem($link);

            // If we on first link and currently active page is not first,
            // we know that this link is for previous pagination item.
            if ($index === 0 && $this->currentPage != 1) {
                $this->markAsPrevious($item);

                continue;
            }

            // If we on last link and currently active page is not last,
            // we know that this link is for next pagination item.
            if (
                $index === $this->getLinksCount(true)
                && $this->currentPage != $this->getLinksCount(true)
            ) {
                $this->markAsNext($item);

                break;
            }

            // We can't use loop index, because sometimes first and
            // last link are for the next and previous item, so use
            // external iterator to index pages of pagination.
            $item->number = $j++;

            // Push pagination pages to items collection.
            $this->items[] = $item;
        }
    }
635194
def urls_linking_to(urls)
      unless urls.is_a?(Array)
        urls = [urls] unless urls.is_a?(Array)
        single = true
      end

      links = pages_linking_to(urls)
      links.each { |url, pages| links[url] = pages.map{|p| p.url} }

      if single and !links.empty?
        return links[urls.first]
      else
        return links
      end
    end
688964
public function getPaginator()
	{
		if ($this->paginator instanceof Closure)
		{
			$this->paginator = call_user_func($this->paginator);
		}

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

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

        return $this->pageUrl($nextPage);
    }
742432
public Links links(String cssSelector, boolean parseSrc) {
        Links links = new Links().addBySelector(doc(), cssSelector,parseSrc);
        return links;
    }
1372871
private function generatePaginationLinks($options = array())
    {
        //Pagination display
        $nbResult = 0;
        $nbPages = 0;
        $currentPage = 0;
        $nextPage = 0;
        $previousPage = 0;
        $nbResultPerPage = 10;
        $offset=4;
        $url = array();

        // Checking if all the parameters are set
        if (isset($options['nbResult'])) {
            $nbResult = $options['nbResult'];
        }
        if (isset($options['nbPages'])) {
            $nbPages= $options['nbPages'];
        }
        if (isset($options['currentPage'])) {
            $currentPage= $options['nbResult'];
        }
        if (isset($options['nextPage'])) {
            $nextPage = $options['nextPage'];
        }
        if (isset($options['previousPage'])) {
            $previousPage = $options['previousPage'];
        }
        if (isset($options['nbResultPerPage'])) {
            $nbResultPerPage= $options['nbResultPerPage'];
        }
        if (isset($options['offset'])) {
            $offset= $options['offset'];
        }

        //Link creation
        for ($i=0; $i<$nbPages; $i++) {
            $paramCreerUrl = $this->variablesGet;
            $paramCreerUrl['debut'] = $i*$nbResultPerPage;
            $url[]=$this->creerUrl(
                '',
                '',
                $paramCreerUrl
            );
        }
        return $url;
    }
1282060
def get_paginator(
        self,
        dataset,
        per_page,
        orphans=0,
        allow_empty_first_page=True,
        **kwargs
    ):
        """"""
        return IndefinitePaginator(
            dataset,
            per_page,
            orphans=orphans,
            allow_empty_first_page=allow_empty_first_page,
            **kwargs
        )
1371125
public function render()
    {
        if (!$this->grid->showPagination()) {
            return '';
        }

        return $this->paginationRanger().
            $this->paginationLinks().
            $this->perPageSelector();
    }
827765
def links(self):
        
        links = super(OffsetLimitPaginatedList, self).links
        if self._page.offset + self._page.limit < self.count:
            links["next"] = Link.for_(
                self._operation,
                self._ns,
                qs=self._page.next_page.to_items(),
                **self._context
            )
        if self.offset > 0:
            links["prev"] = Link.for_(
                self._operation,
                self._ns,
                qs=self._page.prev_page.to_items(),
                **self._context
            )
        return links
238287
function (e) {
        if (e && e.prevValue === e.newValue) {
            return;
        }

        var par   = this.current ? this.current.parentNode : null,
            after = this.link;

        if (par) {
            switch (this.paginator.getTotalPages()) {
                case Paginator.VALUE_UNLIMITED :
                        after = this.na; break;
                case this.paginator.getCurrentPage() :
                        after = this.span; break;
            }

            if (this.current !== after) {
                par.replaceChild(after,this.current);
                this.current = after;
            }
        }
    }
340079
protected function createPaginator()
    {
        $paginator = new Paginator($this->getLimit());
        $paginator = $paginator->withPage($this->getPage());

        return $paginator;
    }
936982
function (e) {
        var p       = this.paginator,
            sel     = this.select,
            options = p.get('rowsPerPageOptions'),
            opt,cfg,val,i,len;

        this.all = null;

        for (i = 0, len = options.length; i < len; ++i) {
            cfg = options[i];
            opt = sel.options[i] ||
                  sel.appendChild(document.createElement('option'));
            val = l.isValue(cfg.value) ? cfg.value : cfg;
            opt.innerHTML = l.isValue(cfg.text) ? cfg.text : cfg;

            if (l.isString(val) && val.toLowerCase() === 'all') {
                this.all  = opt;
                opt.value = p.get('totalRecords');
            } else{
                opt.value = val;
            }

        }

        while (sel.options.length > options.length) {
            sel.removeChild(sel.firstChild);
        }

        this.update();
    }
428162
def pages(self):
        
        # protected access has to be permitted here to not close the paginator's pages

        # pylint: disable=protected-access
        paginator_pages = list(self.paginator._pages)
        if len(self.paginator._current_page) > 1:
            paginator_pages.append('\n'.join(self.paginator._current_page) + '\n' + (self.paginator.suffix or ''))
        # pylint: enable=protected-access

        return paginator_pages
526650
def default_links_pagination_factory(page, urlkwargs):
    """"""
    endpoint = '.communities_list'

    links = {
        'self': url_for(endpoint, page=page.page, _external=True, **urlkwargs),
    }

    if page.has_prev:
        links['prev'] = url_for(endpoint, page=page.prev_num, _external=True,
                                **urlkwargs)
    if page.has_next:
        links['next'] = url_for(endpoint, page=page.next_num, _external=True,
                                **urlkwargs)

    return links
1223679
public function getPages(Paginator $paginator, $pageRange = null)
    {
        $pageRange  = $paginator->getPageRange();
        $pageNumber = $paginator->getCurrentPageNumber();

        $originalPageRange = $pageRange;
        $pageRange         = $pageRange * 2 - 1;

        if ($originalPageRange + $pageNumber - 1 < $pageRange) {
            $pageRange = $originalPageRange + $pageNumber - 1;
        } elseif ($originalPageRange + $pageNumber - 1 > count($paginator)) {
            $pageRange = $originalPageRange + count($paginator) - $pageNumber;
        }

        return parent::getPages($paginator, $pageRange);
    }