I know I asked the question a few years ago, but I don't remember !
The idea is to test whether the document contains only one page or not.
If it contains only one page, the header is enabled.
If it contains several pages, the header is enabled only on the first page but not on the others.