public function paginate($table, $page, $fields = null)
{
$offset = $this->pageLimit * ($page - 1);
$res = $this->withTotalCount()->get($table, array($offset, $this->pageLimit), $fields);
$this->totalPages = ceil($this->totalCount / $this->pageLimit);
return $res;
}