src/Datagrid/Pager.php
public function getLinks($nbLinks = null)
    {
        if (null === $nbLinks) {
            $nbLinks = $this->getMaxPageLinks();
        }
        $links = [];
        $tmp = $this->page - floor($nbLinks / 2);
        $check = $this->lastPage - $nbLinks + 1;
        $limit = $check > 0 ? $check : 1;
        $begin = $tmp > 0 ? ($tmp > $limit ? $limit : $tmp) : 1;

        $i = (int) $begin;
        while ($i < $begin + $nbLinks && $i <= $this->lastPage) {
            $links[] = $i++;
        }

        $this->currentMaxLink = \count($links) ? $links[\count($links) - 1] : 1;

        return $links;
    }
public function getLinks($nbLinks = null)
    {
        if (null === $nbLinks) {
            $nbLinks = $this->getMaxPageLinks();
        }
        $links = [];
        $tmp = $this->page - floor($nbLinks / 2);
        $check = $this->lastPage - $nbLinks + 1;
        $limit = $check > 0 ? $check : 1;
        $begin = $tmp > 0 ? ($tmp > $limit ? $limit : $tmp) : 1;

        $i = (int) $begin;
        while ($i < $begin + $nbLinks && $i <= $this->lastPage) {
            $links[] = $i++;
        }

        $this->currentMaxLink = \count($links) ? $links[\count($links) - 1] : 1;

        return $links;
    }
public function getLinks ( $ nbLinks = null ) { if ( null === $ nbLinks ) { $ nbLinks = $ this -> getMaxPageLinks ( ) ; } $ links = [ ] ; $ tmp = $ this -> page - floor ( $ nbLinks / 2 ) ; $ check = $ this -> lastPage - $ nbLinks + 1 ; $ limit = $ check > 0 ? $ check : 1 ; $ begin = $ tmp > 0 ? ( $ tmp > $ limit ? $ limit : $ tmp ) : 1 ; $ i = ( int ) $ begin ; while ( $ i < $ begin + $ nbLinks && $ i <= $ this -> lastPage ) { $ links [ ] = $ i ++ ; } $ this -> currentMaxLink = \ count ( $ links ) ? $ links [ \ count ( $ links ) - 1 ] : 1 ; return $ links ; }
Returns an array of page numbers to use in pagination links.

@param int $nbLinks The maximum number of page numbers to return

@return array
Returns an array of page numbers to use in pagination links .