handle zero count correctly in pagination