Ugh.. I'm really overthinking this.

PAGE_NR has an optional boolean argument that determines if it should reset after each record. So just forget my previous comment and instead of "PAGE_NR() - 1" do "PAGE_NR(True) - 1".