Also, a minor nitpick/microoptimization: Switching those two only invokes count() if necessary (page === 1)