$doc2 .= substr( $tkntext, 0, rindex( $tkntext, ' ', $maxlen ) );