public function shortText($text, $length)
    {
        $text = trim($text);
        $charset = mb_detect_encoding($text);

        if (mb_strlen($text, $charset) > $length) {
            $text = mb_substr($text, 0, $length, $charset) . '...';
        } else {
            $text = $text;
        }

        return $text;
    }