Make condition for incrementing num_page