reworked total page counter