And please review the previous statement when the last page is the second page. I think that your implementation just work for 3 or more pages