sync.sh: Fix pagination problem