Fixing infinite length page problem

Bounding the page height to the smaller of the desired height and
the height suggested by the rendering system.