fix infinite loop when there were only few search results (so that only a single results page should have been generated)