public function getOffset($perPage = null)
{
if ($perPage && ($offset = $this->getOffsetFromNumber($perPage))) {
return $offset;
}
$offset = (int) $this->getPage('offset');
if ($offset < 0) {
throw new InvalidParameterException('page[offset] must be >=0', 2, null, 'page[offset]');
}
return $offset;
}