From: Alexander Ebert Date: Mon, 8 May 2023 09:58:09 +0000 (+0200) Subject: Simplify the code to calculate the number of paragraphs to retain X-Git-Tag: 6.0.0_Alpha_1~136^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ff6e9510b8d2f0e622e1c0959502ef0b6c53f23;p=GitHub%2FWoltLab%2FWCF.git Simplify the code to calculate the number of paragraphs to retain --- diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php index 2ba481cc3b..4bf2fdafab 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php @@ -83,13 +83,8 @@ final class HtmlOutputNodeNormalizer // We need to reduce the number of paragraphs by half, unless it // is an uneven number in which case we need to remove one // additional paragraph. - if ($offset % 2 === 1) { - // 2 -> 1, 4 -> 2 - $numberOfParagraphsToRemove = \ceil($offset / 2); - } else { - // 3 -> 1, 5 -> 2 - $numberOfParagraphsToRemove = \ceil($offset / 2) + 1; - } + $totalNumberOfParagraphs = $offset + 1; + $numberOfParagraphsToRemove = \ceil($totalNumberOfParagraphs / 2); $removeParagraphs = \array_slice($paragraphs, $i, $numberOfParagraphsToRemove); foreach ($removeParagraphs as $paragraph) {