source/Pagination.php
public function build()
    {
        if ($this->totalItems == 0 || $this->totalPages == 1) {
            return array();
        }

        $output = array();

        // Previous
        $offset = $this->currentPage - 1;
        $limit = $this->currentPage - $this->neighbours;
        $limit = $limit < self::BASE_PAGE ? self::BASE_PAGE : $limit;
        for ($i = $offset; $i >= $limit; $i--) {
            $output[$i] = self::TAG_PREVIOUS;
        }

        if ($limit - self::BASE_PAGE >= 2) {
            $output[$limit - 1] = self::TAG_LESS;
        }

        // First
        if ($this->currentPage - $this->neighbours > self::BASE_PAGE) {
            $output[self::BASE_PAGE] = self::TAG_FIRST;
        }

        // Next
        $offset = $this->currentPage + 1;
        $limit = $this->currentPage + $this->neighbours;
        $limit = $limit > $this->totalPages ? $this->totalPages : $limit;
        for ($i = $offset; $i <= $limit; $i++) {
            $output[$i] = self::TAG_NEXT;
        }

        if ($this->totalPages - $limit > 0) {
            $output[$limit + 1] = self::TAG_MORE;
        }

        // Last
        if ($this->currentPage + $this->neighbours < $this->totalPages) {
            $output[$this->totalPages] = self::TAG_LAST;
        }

        // Current
        $output[$this->currentPage] = self::TAG_CURRENT;

        ksort($output);

        return $output;
    }
public function build()
    {
        if ($this->totalItems == 0 || $this->totalPages == 1) {
            return array();
        }

        $output = array();

        // Previous
        $offset = $this->currentPage - 1;
        $limit = $this->currentPage - $this->neighbours;
        $limit = $limit < self::BASE_PAGE ? self::BASE_PAGE : $limit;
        for ($i = $offset; $i >= $limit; $i--) {
            $output[$i] = self::TAG_PREVIOUS;
        }

        if ($limit - self::BASE_PAGE >= 2) {
            $output[$limit - 1] = self::TAG_LESS;
        }

        // First
        if ($this->currentPage - $this->neighbours > self::BASE_PAGE) {
            $output[self::BASE_PAGE] = self::TAG_FIRST;
        }

        // Next
        $offset = $this->currentPage + 1;
        $limit = $this->currentPage + $this->neighbours;
        $limit = $limit > $this->totalPages ? $this->totalPages : $limit;
        for ($i = $offset; $i <= $limit; $i++) {
            $output[$i] = self::TAG_NEXT;
        }

        if ($this->totalPages - $limit > 0) {
            $output[$limit + 1] = self::TAG_MORE;
        }

        // Last
        if ($this->currentPage + $this->neighbours < $this->totalPages) {
            $output[$this->totalPages] = self::TAG_LAST;
        }

        // Current
        $output[$this->currentPage] = self::TAG_CURRENT;

        ksort($output);

        return $output;
    }
public function build ( ) { if ( $ this -> totalItems == 0 || $ this -> totalPages == 1 ) { return array ( ) ; } $ output = array ( ) ; // Previous $ offset = $ this -> currentPage - 1 ; $ limit = $ this -> currentPage - $ this -> neighbours ; $ limit = $ limit < self :: BASE_PAGE ? self :: BASE_PAGE : $ limit ; for ( $ i = $ offset ; $ i >= $ limit ; $ i -- ) { $ output [ $ i ] = self :: TAG_PREVIOUS ; } if ( $ limit - self :: BASE_PAGE >= 2 ) { $ output [ $ limit - 1 ] = self :: TAG_LESS ; } // First if ( $ this -> currentPage - $ this -> neighbours > self :: BASE_PAGE ) { $ output [ self :: BASE_PAGE ] = self :: TAG_FIRST ; } // Next $ offset = $ this -> currentPage + 1 ; $ limit = $ this -> currentPage + $ this -> neighbours ; $ limit = $ limit > $ this -> totalPages ? $ this -> totalPages : $ limit ; for ( $ i = $ offset ; $ i <= $ limit ; $ i ++ ) { $ output [ $ i ] = self :: TAG_NEXT ; } if ( $ this -> totalPages - $ limit > 0 ) { $ output [ $ limit + 1 ] = self :: TAG_MORE ; } // Last if ( $ this -> currentPage + $ this -> neighbours < $ this -> totalPages ) { $ output [ $ this -> totalPages ] = self :: TAG_LAST ; } // Current $ output [ $ this -> currentPage ] = self :: TAG_CURRENT ; ksort ( $ output ) ; return $ output ; }
Display.

@return array
Display .