public function setLimit($limit, $offset = 0)
    {
        if ((is_numeric($limit) && $limit < 0) || (is_numeric($offset) && $offset < 0)) {
            throw new InvalidArgumentException("SQLSelect::setLimit() only takes positive values");
        }

        if ($limit === 0) {
            Deprecation::notice(
                '4.3',
                "setLimit(0) is deprecated in SS4. To clear limit, call setLimit(null). " .
                    "In SS5 a limit of 0 will instead return no records."
            );
        }

        if (is_numeric($limit) && ($limit || $offset)) {
            $this->limit = array(
                'start' => (int)$offset,
                'limit' => (int)$limit,
            );
        } elseif ($limit && is_string($limit)) {
            if (strpos($limit, ',') !== false) {
                list($start, $innerLimit) = explode(',', $limit, 2);
            } else {
                list($innerLimit, $start) = explode(' OFFSET ', strtoupper($limit), 2);
            }

            $this->limit = array(
                'start' => (int)$start,
                'limit' => (int)$innerLimit,
            );
        } elseif ($limit === null && $offset) {
            $this->limit = array(
                'start' => (int)$offset,
                'limit' => $limit
            );
        } else {
            $this->limit = $limit;
        }

        return $this;
    }