How to set conditions to skip pages in the middle