Might be worth confirming at this point that the data is actually an array.

Anything with an undefined `length` (`{}` or `1`, for example) would return `NaN` when divided by `pageSize`, which would (weirdly) not be greater than, smaller than *or* equal to `page`. `Null` would fail at this point for not having a length, and slicing a string might not be quite the result we're expecting (though it would work).

There may well be other scenarios that would be a bit odd, too.