Do total count correctly for limit and offset in query