Deduplicate get page code