XWIKI-9370: PDF Export doesn't list the Table of Contents under certain circumstances
* Add functional test.