Sets the limit and count by page number.

@param int $page Limit results to this page number.
@param int $rowCount Use this many rows per page.
@return Zend_Db_Select This Zend_Db_Select object.
357826
public function limitPage($page, $rowCount)
    {
        $page     = ($page > 0)     ? $page     : 1;
        $rowCount = ($rowCount > 0) ? $rowCount : 1;
        $this->_parts[self::LIMIT_COUNT]  = (int) $rowCount;
        $this->_parts[self::LIMIT_OFFSET] = (int) $rowCount * ($page - 1);
        return $this;
    }
1348317
public function limit($limit, $page = 1) {
        if($page >= 1) $this->page = $page;
        $this->limit = $limit;

        return $this;
    }
585095
public function paginate($limit = null, $columns = ['*'], $method = "paginate")
    {
        return parent::paginate(
            $limit,
            $this->getColumnsNames($columns),
            $method
        );
    }
1044746
public function count()
    {
        if ($this->_rowCount === null) {
            $rowCount = $this->_query->count();
            $this->setRowCount($rowCount);
        }

        return $this->_rowCount;
    }
821165
public function setLimit($count, $offset = null)
    {
        $this->_dsql()->limit($count, $offset);

        return $this;
    }
956581
public function setNumPerPage($count)
    {
        if (!is_numeric($count)) {
            throw new InvalidArgumentException(
                'Number Per Page must be numeric.'
            );
        }

        $count = (int)$count;
        if ($count < 0) {
            throw new InvalidArgumentException(
                'Number Per Page must be greater than zero.'
            );
        }

        $this->numPerPage = $count;
        return $this;
    }
1207203
private function setCount(int $count): self
    {
        $this->count = max($count, 0);
        if ($this->count > 0) {
            $this->countPages = (int)ceil($this->count / $this->limit);
        } else {
            $this->countPages = 1;
        }

        return $this;
    }
213109
public function page($page)
    {
        $limit = $this->getSqlPart('limit');
        if (!$limit) {
            $limit = 10;
            $this->add('limit', $limit);
        }
        return $this->offset(($page - 1) * $limit);
    }
1242172
public static function getPagination($limit = 10, $identity = null)
    {
        $limit = (int) $limit;
        $count = static::countByIdentity($identity);
        if ($limit > $count) {
            $limit = $count;
        }
        return new Pagination(['totalCount' => $count, 'pageSize' => $limit]);
    }
577788
public function limit($sql, $count, $offset = 0)
    {
        $count = intval($count);
        if ($count <= 0) {
            /**
             * @see Zend_Db_Adapter_Db2_Exception
             */
            // require_once 'Zend/Db/Adapter/Db2/Exception.php';
            throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument count=$count is not valid");
        }

        $offset = intval($offset);
        if ($offset < 0) {
            /**
             * @see Zend_Db_Adapter_Db2_Exception
             */
            // require_once 'Zend/Db/Adapter/Db2/Exception.php';
            throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument offset=$offset is not valid");
        }

        if ($offset == 0) {
            $limit_sql = $sql . " FETCH FIRST $count ROWS ONLY";
            return $limit_sql;
        }

        /**
         * DB2 does not implement the LIMIT clause as some RDBMS do.
         * We have to simulate it with subqueries and ROWNUM.
         * Unfortunately because we use the column wildcard "*",
         * this puts an extra column into the query result set.
         */
        $limit_sql = "SELECT z2.*
            FROM (
                SELECT ROW_NUMBER() OVER() AS \"ZEND_DB_ROWNUM\", z1.*
                FROM (
                    " . $sql . "
                ) z1
            ) z2
            WHERE z2.zend_db_rownum BETWEEN " . ($offset+1) . " AND " . ($offset+$count);
        return $limit_sql;
    }
176996
public function paginate($page, $pageSize)
    {
        $start = $page * $pageSize;
        return $this->limit($pageSize, $start);
    }
910025
public function limit($page, $length)
    {
        $this->page = $page;
        $this->length = $length;

        return $this;
    }
446380
public static function get($page, $totalCount, $pageSize = 30)
    {
        $page = self::getPage($page);
        $pageCount = self::getPageCount($totalCount, $pageSize);
        $next = self::getNext($page, $pageCount);
        $pre = self::getPre($page);
        $limit = self::getLimit($pageSize);
        $offset = self::getOffset($page, $pageSize);
        return [
            'page' => $page,//当前页数
            'pageSize' => $pageSize,//分页大小
            'totalCount' => $totalCount,//总数
            'pageCount' => $pageCount,//总页数
            'next' => $next,//下一页
            'pre' => $pre,//上一页
            'limit' => $limit,//limit
            'offset' => $offset,//offset
        ];
    }
1258093
public function paginate($page, $per_page = 50) 
    {
        $this->_builder->limit  = $per_page;
        $this->_builder->offset = ($page - 1) * $per_page;
        $this->page             = $page;
        $this->per_page         = $per_page;

        if (Driver::$pagination_subquery) {
            $this->_builder->limit   = $this->_builder->offset + $per_page;
            $this->_builder->offset  = $this->_builder->offset + 1;
        }
        return $this;
    }
899541
protected function set_limit($query, $limit = 0, $offset = 0)
    {
        $limit  = intval($limit);
        $offset = intval($offset);
        $end    = $offset + $limit;

        // query without OFFSET
        if (!$offset) {
            $query = preg_replace('/^SELECT\s/i', "SELECT TOP $limit ", $query);
            return $query;
        }

        $orderby = stristr($query, 'ORDER BY');
        $offset += 1;

        if ($orderby !== false) {
            $query = trim(substr($query, 0, -1 * strlen($orderby)));
        }
        else {
            // it shouldn't happen, paging without sorting has not much sense
            // @FIXME: I don't know how to build paging query without ORDER BY
            $orderby = "ORDER BY 1";
        }

        $query = preg_replace('/^SELECT\s/i', '', $query);
        $query = "WITH paging AS (SELECT ROW_NUMBER() OVER ($orderby) AS [RowNumber], $query)"
            . " SELECT * FROM paging WHERE [RowNumber] BETWEEN $offset AND $end ORDER BY [RowNumber]";

        return $query;
    }
454098
public function setPage($page)
    {
        Argument::i()->test(1, 'int');
        
        if ($page < 1) {
            $page = 1;
        }
        
        $this->start = ($page - 1) * $this->range;
        
        return $this;
    }
880021
public function paginate($page, $per_page=10) {
		$this->page = $page = $page ? $page:1;
		$this->per_page = $per_page;
		$this->offset(($page-1)*$per_page);
		$this->limit($per_page);

		return $this;
	}