My PEz (MRSDK based) puts the number in the right margin ONLY at the change point (can be many numberless screens between).
As best I can tell, this is based visible word content, not markup. (Bulky

markup just make it crawl on page turns). Maximum Page numbers and EPUB file size do not track (some proof again that images are not counted)