[ticket/12681] Generate the list of the route only when needed

PHPBB3-12681
Merge branch 'ticket/12681' into performances