JCR-2260 : Query does not work well with QueryImpl.setOffset() and setLimit()

Fix description:
- when the clicked page is empty, return to the previous pages util meet an unempty page