diff options
author | Andrew Dolgov <[email protected]> | 2016-02-17 16:42:13 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2016-02-17 16:42:13 +0300 |
commit | cc43e19b44bd702be93c2244d1ae81a0cb14c69f (patch) | |
tree | 06dbb601ecfe87e026ecf41a80d996344ca3f03b /include/functions.php | |
parent | 1003f71e0459b4b5e7d5e7b393d0baba02e82808 (diff) |
error handler: do not log last query, truncate error message to a smaller length
Diffstat (limited to 'include/functions.php')
-rwxr-xr-x | include/functions.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/functions.php b/include/functions.php index b558b0e6c..d43943966 100755 --- a/include/functions.php +++ b/include/functions.php @@ -878,6 +878,15 @@ } } + // is not utf8 clean + function truncate_middle($str, $max_len, $suffix = '…') { + if (strlen($str) > $max_len) { + return substr_replace($str, $suffix, $max_len / 2, mb_strlen($str) - $max_len); + } else { + return $str; + } + } + function convert_timestamp($timestamp, $source_tz, $dest_tz) { try { |