Cake\Database\Query::page PHP Метод

page() публичный Метод

This method provides an easier to use interface to set the limit + offset in the record set you want as results. If empty the limit will default to the existing limit clause, and if that too is empty, then 25 will be used. Pages should start at 1.
public page ( integer $num, integer | null $limit = null )
$num integer The page number you want.
$limit integer | null The number of rows you want in the page. If null the current limit clause will be used.
    public function page($num, $limit = null)
    {
        if ($limit !== null) {
            $this->limit($limit);
        }
        $limit = $this->clause('limit');
        if ($limit === null) {
            $limit = 25;
            $this->limit($limit);
        }
        $offset = ($num - 1) * $limit;
        if (PHP_INT_MAX <= $offset) {
            $offset = PHP_INT_MAX;
        }
        $this->offset((int) $offset);
        return $this;
    }