Файл: core/class/navigation.php
Строк: 40
<?php
class pager
{
public $start;
public $end;
public $pages;
public $page;
public $count;
public $url;
function __construct($count, $end, $url){
$this->page = abs(intval($_REQUEST['page']));
$this->count = $count;
$this->url = $url;
$this->end = $end;
$this->pages = intval($this->count / $this->end)+1;
if(empty($this->page) || $this->page < 0)$this->page = 1;
if($this->page > $this->pages) $this->page = $this->pages;
$this->start = $this->page * $this->end - $this->end;
$this->end = $this->end;
}
function pag ()
{
if($this->pages > 1){
$bp = $this->page - 1;
$np = $this->page + 1;
$bp2 = $this->page - 2;
$np2 = $this->page + 2;
$page = $this->page;
echo '<div class="downlist2">';
if($this->page > 1){
$back = '<a href="'.$this->url.'page='.$bp.'">'.$bp.'</a> ';
$last = '<a href="'.$this->url.'page='.$bp.'">« Назад</a> ';
}
if($this->page < $this->pages){
$next = ' <a href="'.$this->url.'page='.$np.'">'.$np.'</a>';
$new = ' <a href="'.$this->url.'page='.$np.'">Далее »</a>';
}
if($bp2 >= 1)$back2 = '<a href="'.$this->url.'page='.$bp2.'">'.$bp2.'</a> ';
if($np2 <= $this->pages)$next2 = ' <a href="'.$this->url.'page='.$np2.'">'.$np2.'</a>';
if($bp2 > 1)$st_l = '<a href="'.$this->url.'page=1">«1</a> ';
if($np2 < $this->pages)$nx_l = ' <a href="'.$this->url.'page='.$this->pages.'">'.$this->pages.'»</a>';
echo $last.$new.'<br/>'.$st_l.$back2.$back.$page.$next.$next2.$nx_l;
echo '</div>';
}
}
}
?>