total; $this->perpage; $this->maxpage; $this->offset = 9; } function getpagelist() { $result_pages = ""; $this->pages = ceil($this->total / $this->perpage); if ($this->pages > $this->maxpage) { $from = $this->curr_page - $this->offset; if ($from < 1) { $from = 1; } $to = $from + $this->maxpage - 1; if ($to > $this->pages) { $to = $this->pages; $from = $to - $this->maxpage + 1; /* if (($to - $from) < $this->maxpage) { $from = $from - 1; } */ } } else { $from = 1; $to = $this->pages; } $p = 0; for($i = $from; $i <= $to; $i++) { $result_pages[$p] = $i; $p++; } return $result_pages; } function getfirst() { if ($this->curr_page > 1 && $this->pages > 1) { return 1; } else { return ""; } } function getlast() { if ($this->pages > 1 && $this->curr_page < $this->pages) { return $this->pages; } else { return ""; } } function getprev() { $prevpage = $this->curr_page - 1; if ($prevpage > 0) { return $prevpage; } else { $prevpage = ""; return $prevpage; } } function getnext() { $nextpage = $this->curr_page + 1; if ($nextpage <= $this->pages) { return $nextpage; } else { $nextpage = ""; return $nextpage; } } function gettotal() { if ($this->pages > 0) { return $this->pages; } else { return 1; } } } ?>