Check number of pages when retrieving a page

Removed as well unnecessary early return when setting the number of elements per page with the same value as the current one.