Merge pull request #11524 from nazar-pc/patch-1

Page size calculation based on real page height
Merge pull request #12624 from nazar-pc/stable7

Backport of #11524 into stable7