public function __construct($totalRows, $numPerPage = 20, $param = [])
{
$this->totalRows = $totalRows;
$this->numPerPage = $numPerPage ? intval($numPerPage) : 10;
$this->pageShowVarName = Config::get('var_page') ? Config::get('var_page') : 'p';
$this->param = $param;
$this->totalPages = ceil($this->totalRows / $this->numPerPage);
$this->coolPages = ceil($this->totalPages / $this->barShowPage);
$this->nowPage = Input::getInt($this->pageShowVarName, 1);
if ($this->nowPage < 1) {
$this->nowPage = 1;
} elseif (!empty($this->totalRows) && $this->nowPage > $this->totalPages) {
$this->nowPage = $this->totalPages;
}
$this->firstRow = $this->numPerPage * ($this->nowPage - 1);
}