public function truncate($text, $limit, $isFile = false, $encoding = 'UTF-8')
    {
        $ext = null;
        if ($isFile) {
            $ext = $this->getExt($text);
            if ($ext) {
                $limit -= mb_strlen($ext, $encoding);
                $text = mb_substr($text, 0, -mb_strlen($ext, $encoding) - 1);
            }
        }

        if (mb_strlen($text, $encoding) > $limit) {
            $text = mb_substr($text, 0, $limit - 3, $encoding).'...';
        }

        return $text.($ext ? '.'.$ext : null);
    }