So far it returned 0 because of those in range checks which both applied because numberOfPages is 0 if we have no record.