Simplify getVisiblePages and fix searching in presentation mode