This is also wrong, you just have to invert your comparison ` if ($page <= $count / $pageSize)` and add a check on `$pageSize` value.
if value is less than or equal to 0, throw a LogicException