check if number of pages is valid.