diff --git a/module/VuFind/src/VuFind/Tags.php b/module/VuFind/src/VuFind/Tags.php
index 1716490aa640c6a962ee1afda13265df0d307909..62bfae2002227def3803797aba411e812fe7e25f 100644
--- a/module/VuFind/src/VuFind/Tags.php
+++ b/module/VuFind/src/VuFind/Tags.php
@@ -38,6 +38,23 @@ namespace VuFind;
  */
 class Tags
 {
+    /**
+     * Maximum tag length.
+     *
+     * @var int
+     */
+    protected $maxLength;
+
+    /**
+     * Constructor
+     *
+     * @param int $maxLength Maximum tag length
+     */
+    public function __construct($maxLength = 64)
+    {
+        $this->maxLength = $maxLength;
+    }
+
     /**
      * Parse a user-submitted tag string into an array of separate tags.
      *
@@ -50,7 +67,8 @@ class Tags
         preg_match_all('/"[^"]*"|[^ ]+/', trim($tags), $words);
         $result = array();
         foreach ($words[0] as $tag) {
-            $result[] = str_replace('"', '', $tag);
+            // Wipe out double-quotes and trim over-long tags:
+            $result[] = substr(str_replace('"', '', $tag), 0, $this->maxLength);
         }
         return array_unique($result);
     }
diff --git a/module/VuFind/tests/unit-tests/src/TagsTest.php b/module/VuFind/tests/unit-tests/src/TagsTest.php
index 5b338962b9208a772eef3b1cb3fb9493d866af56..d3a50d03a1b4352c466500dcf8b6fbe0921773e1 100644
--- a/module/VuFind/tests/unit-tests/src/TagsTest.php
+++ b/module/VuFind/tests/unit-tests/src/TagsTest.php
@@ -85,4 +85,16 @@ class TagsTest extends \PHPUnit_Framework_TestCase
     {
         $this->assertEquals(array('test'), $this->parser->parse('test test test'));
     }
+
+    /**
+     * Test truncation
+     *
+     * @return void
+     */
+    public function testTruncation()
+    {
+        // Create custom object w/ small size limit:
+        $parser = new \VuFind\Tags(10);
+        $this->assertEquals(array('0123456789'), $parser->parse('01234567890'));
+    }
 }
\ No newline at end of file