This function doesn't work quite as expected in 0.5.1. The page number is not incremented, except as part of the page_text function.
You'll get the expected results in 0.6.0.
I would also like note that you're getting into some tricky usage of the DOMPDF API. I certainly can't blame you for using it (the functionality is available), but it hasn't really been fully developed. In your script, when you programmatically start a new page the "cursor" position isn't reset, so any additional HTML will be added at the current position. See the following:
These are things we can address, but the focus right now is on fleshing out the HTML rendering functionality.
Also, we're not planning any patches to 0.5.1 ... so some of what you're trying to do will require the 0.6.0 release.