Index: typo3/class.webpagetree.php =================================================================== --- typo3/class.webpagetree.php (revision 6388) +++ typo3/class.webpagetree.php (working copy) @@ -235,7 +235,9 @@ $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$v['bank'])."\n"; - if(!$v['hasSub']) { $itemHTML .= ''; } + if(!$v['hasSub'] || ($v['invertedDepth'] === 1000 && key($closeDepth) === 999)) { + $itemHTML .= ''; + } // we have to remember if this is the last one // on level X so the last child on level X+1 closes the