calculates the first and last page to show

@return void
188096
protected function calculateFirstAndLastPage()
    {
        $delta = \floor($this->maximumNumberOfLinks / 2);
        $firstPage = $this->currentPage - $delta;
        $lastPage = $this->currentPage + $delta + ($this->maximumNumberOfLinks % 2 === 0 ? 1 : 0);

        if ($firstPage < 1) {
            $lastPage -= $firstPage - 1;
        }
        if ($lastPage > $this->numberOfPages) {
            $firstPage -= ($lastPage - $this->numberOfPages);
        }

        $this->firstPage = \max($firstPage, 1);
        $this->lastPage = \min($lastPage, $this->numberOfPages);
    }
523240
protected function pages_prepare_next(){
		if($this->page_next<=$this->pages_count){
			$url=$this->generateurl($this->page_next);
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>$url,
				'active'=>($this->page_next==$this->page_active),
				'disabled'=>false
				);
			}else{
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>'',
				'active'=>false,
				'disabled'=>true
				);
			}
		}
466664
protected function getPaginationData()
	{
		// Choose page range ( window ) and set start/end page range.
		$this->setPageRange();

		// Set previous/next page number.
		$this->setPrevNumPage();
		$this->setNextNumPage();

		$pagination['template']		= $this->layout_template;
		$pagination['items_total'] 	= $this->getNumTotalResults();
		$pagination['item_start']		= ( ( $this->prev_num_page * $this->items_per_page ) + 1 );
		$pagination['item_end']		= ( $this->current_page_number * $this->items_per_page );
		$pagination['params']			= $this->params_template;
		if ( $pagination['item_end'] > $this->getNumTotalResults() )
		{
			$pagination['item_end'] = $this->getNumTotalResults();
		}
		$pagination['num_pages']		= $this->num_pages;
		$pagination['current_page']	= $this->current_page_number;

		// Links.
		for ( $i = $this->start_page_range; $i<= $this->end_page_range; $i++ )
		{
			$pagination['pages'][$i]['number']		= (int)$i;
		 	$pagination['pages'][$i]['is_current'] 	= ( $i == $this->current_page_number );

		 	$pagination['pages'][$i]['link'] 		= $this->url_base;
		 	if ( 1 != $i )
		 	{
		 		$pagination['pages'][$i]['link'] 	= $this->url_base . $this->separator_link_page . $i;
		 	}

		}

		if ( $this->prev_num_page > 0 )
		{
			$pagination['previous_page']['number'] 	= $this->prev_num_page;

			$pagination['previous_page']['link'] 		= $this->url_base;
			if ( 1 != $this->prev_num_page )
			{
				$pagination['previous_page']['link'] = $this->url_base . $this->separator_link_page . $this->prev_num_page;
			}
		}

		if ( $this->next_num_page > 0 )
		{
			$pagination['next_page']['number'] 		= $this->next_num_page;
			$pagination['next_page']['link'] 			= $this->url_base . $this->separator_link_page . $this->next_num_page;;
		}

		if ( 1 != $this->current_page_number )
		{
			$pagination['first_page']['number'] 		= 1;
			$pagination['first_page']['link'] 		= $this->url_base;
		}

		if ( $this->num_pages != $this->current_page_number )
		{
			$pagination['last_page']['number']	 	= $this->num_pages;
			$pagination['last_page']['link'] 			= $this->url_base . $this->separator_link_page . $this->num_pages;
		}

		$pagination['items_per_page'] 		= $this->items_per_page;
		$pagination['display_items_per_page'] = $this->display_items_per_page;

		return $pagination;
	}
1051146
private function calculateTotalPages()
    {
        // With zero items, there is still one page
        if ($this->getTotalItems() === 0) {
            $this->setTotalPages(1);
            return;
        }

        // The total amount of pages is calculated by dividing the total amount of items by the items per page
        $totalPages = ceil($this->getTotalItems() / $this->getLimit());

        $this->setTotalPages((int)$totalPages);
    }
641675
protected function calculatePages()
    {
        if ($this->nb_record && $this->total > $this->nb_record) {
            $this->previous_page = $this->nb_page - 1;
            if ($this->previous_page == 0)
                $this->previous_page = false;

            $test = ($this->total / $this->nb_record);
            if ($this->nb_page == intval(ceil($test)))
                $this->next_page = false;
            else
                $this->next_page = $this->nb_page + 1;
        }
    }
1303627
protected function _offsets()
    {
        if($display = $this->display)
        {
            $start  = min($this->count, (int) max($this->current - $display, 1));
            $stop   = (int) min($this->current + $display, $this->count);

            $pages = range($start, $stop);

            if ($this->current > 2) {
                array_unshift($pages, 1, 2);
            }

            if ($this->count - $this->current > 2) {
                array_push($pages, $this->count-1, $this->count);
            }
        }
        else $pages = range(1, $this->count);

        $result = array();
        foreach($pages as $pagenumber) {
            $result[$pagenumber] =  ($pagenumber-1) * $this->limit;
        }

        return $result;
    }
1108257
private function calculateLastItemOnPage()
    {
        // When no limit, the last item is the total amount of items
        if (! $this->hasLimit()) {
            $this->setLastItemOnPage($this->getTotalItems());
            return;
        }

        // Determine the last item on the page
        $lastItem = $this->getOffset() + $this->getLimit();
        if ($this->getTotalItems() !== 0 && $lastItem > $this->getTotalItems()) {
            $lastItem = $this->getTotalItems();
        }

        $this->setLastItemOnPage((int)$lastItem);
    }
790190
public function getFirstPageParams()
    {
        $limit = $this->limit <= 0 ? $this->count : $this->limit;
        $first_url = $this->offset_key . '0' . $this->limit_key . $limit;

        return $first_url;
    }
584704
public function getNextPage()
    {
        $nextPage = $this->getPage() + 1;
        $lastPage = $this->getLastPage();
        if ($lastPage < $nextPage) {
            $nextPage = $lastPage;
        }

        return $nextPage;
    }
1198135
protected function calculateLastPage()
    {
        if (empty($this->total)) {
            $this->lastPage = 0;
            return;
        }

        if (empty($this->perPage)) {
            throw new \RuntimeException('Cannot calculate last page. Insufficient data');
        }

        $this->lastPage = (int) ceil($this->total / $this->perPage);
    }
315736
public function getPreviousPage()
    {
        $previousPage = $this->getPage() - 1;
        $firstPage = $this->getFirstPage();
        if ($firstPage > $previousPage) {
            $previousPage = $firstPage;
        }

        return $previousPage;
    }
623269
public function getTotalPages()
    {
        // Pages before
        $pages = ceil(($this->getFirstShown() - 1) / $this->getItemsPerPage());

        // Current page
        $pages++;

        // Pages after
        $pages += ceil(($this->getTotalRecords() - $this->getLastShown()) / $this->getItemsPerPage());

        return (int) $pages;
    }
1099732
protected function calculatePages()
    {
        $this->total_pages = ceil($this->total_records / $this->page_size);

        if (
            $this->total_pages <= 1 ||
            $this->total_pages == $this->current_page
        ) {
            $this->next_page = 0;
        } else {
            $this->next_page = $this->current_page + 1;
        }

        if ($this->current_page > 0) {
            $this->prev_page = $this->current_page - 1;
        } else {
            $this->prev_page = 0;
        }
    }
331115
private function calculatePageLimitAndOffset()
    {
        $pageUri = '';
        $pageUri = Url::segment(3);
        $pageNumber = ($pageUri !== '') ? $pageUri : 0;

        if ($pageNumber) {
            //calculate starting point of pagination
            $start = ($this->getPageNumber() - 1) * $this->perPage;
        } else {
            $start = 0; //set start to 0 by default.
        }

        $this->setPageNumber($pageNumber);
        $this->setPaginationOffset($start);
    }
735854
public function totalPages()
    {
        $link = $this->_doc->navigation('self');
        return ($link && isset($link->totalpages)) ? $link->totalpages : 1;
    }
1205667
private function setPagination()
    {
        // ALl Pages
        if ($this->perPage == 'all') return;

        $this->firstPage    = 1;
        $this->lastPage     = ceil($this->totalCount / $this->perPage);

        // if current page is greater than the total page
        // then set the current page equal to total page
        $this->page = min($this->page, $this->lastPage);

        // Calculate the offset of where the retrieval index start at
        $this->offset   = ($this->page - 1) * $this->perPage;
        $this->limit    = $this->perPage;

        // Next Page And Previous Page
        $this->nextPage = min($this->page + 1, $this->lastPage);
        $this->prevPage = max($this->page - 1, $this->firstPage);
    }
919969
public function LastItem()
    {
        $pageLength = $this->getPageLength();
        if (!$pageLength) {
            return $this->getTotalItems();
        } elseif ($start = $this->getPageStart()) {
            return min($start + $pageLength, $this->getTotalItems());
        } else {
            return min($pageLength, $this->getTotalItems());
        }
    }