[ticke/11805] Move page-url generating code into a new function

PHPBB3-11805