[ticket/11675] Fix template loop

PHPBB3-11675
Merge pull request #1554 from EXreaction/ticket/11675

[ticket/11675] Fix template loop