prevent empty condition when counting page

though it is still work, but it will throw exception when combine with Geospatial search