Fix #3620

When switching pages, set iStartPos to 0.
Remove empty page detection in input loop, because it has already been detected before entering the loop.