typo
implemented truncation of strings in database to avoid errors
added quick phpdoc script