diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index a207fc28e9..25144f5af3 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -398,10 +398,10 @@ function get_context(string $text, array $words, int $length = 400) // Get the last fragment $fragments[] = $fragment; - $output = htmlentities(implode('', $fragments)); + return htmlentities(implode('', $fragments)); } - return $output; + return htmlentities($text_length >= $length + 3 ? utf8_substr($text, 0, $length) . ' ...' : $text); } /**