Use pageLoop for structree and civinfo
Deduplicate code in four places.
Comments by: @elexis
Differential Revision: https://code.wildfiregames.com/D5261