Hotfix on pagination

@felixgilles Didn't you came up with a solution too ?

I will merge with master when approved...