factor out the get_page_size method as @oalders suggested for #1356