public static function word_substr($text, $from, $minlength, $maxlength) {
        $text = mb_substr($text, $from, $maxlength);
        $p1 = strrpos($text, ' ');
        if ($p1 >= $minlength) {
            return mb_substr($text, 0, $p1);
        }
        return $text;
    }