diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index 6896a7cf..6372dde1 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -360,7 +360,7 @@ class Adminer {
function messageQuery($query) {
$id = "sql-" . count($_SESSION["messages"]);
$_SESSION["history"][$_GET["server"]][DB][] = $query;
- return " " . lang('SQL command') . "
';
+ return " " . lang('SQL command') . "';
}
/** Functions displayed in edit form
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 5a4a5b69..e43baa32 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -307,10 +307,10 @@ function is_utf8($val) {
* @return string escaped string with appended ...
*/
function shorten_utf8($string, $length = 80, $suffix = "") {
- if (!preg_match("~^((?:.|\n){0,$length})(.|\n)?~u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions
- preg_match("(^([\t\r\n -~]{0,$length})(.?))s", $string, $match);
+ if (!preg_match("(^([\t\r\n -\x{FFFF}]{0,$length})($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
+ preg_match("(^([\t\r\n -~]{0,$length})($)?)", $string, $match);
}
- return h($match[1]) . $suffix . ($match[2] ? "..." : "");
+ return h($match[1]) . $suffix . (isset($match[2]) ? "" : "...");
}
/** Generate friendly URL