H2..H6 headers generate incorrect levels/numbering in Table of Contents

Description

In case of H2 or higher headers the ToC broken if there is more headers in the page.
The expected ToC export:
1. Title
1.1. Header2
1.2. Header2
1.3. Header3
The generated ToC export:
1. Title
1.1. Header2
1.1.1. Header2
1.1.2. Header3

Environment

None

Preliminary Test Cases

None

Assignee

Daniel Marczisovszky [META-INF]

Reporter

András Németh

Labels

None

Access to limited visibility issues

None

Product platform

Server
Cloud

Ready for Development

None

Time tracking

6h

Sprint

None

Fix versions

Priority

Major
Configure