]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/PageRepo.php
Merge branch 'v0.11'
[bookstack] / app / Repos / PageRepo.php
index d3b71cebd1b895e941adc8e07acb61f7c72c8baa..235246f823ef9696e1e97e934da79605dffe31b2 100644 (file)
@@ -599,14 +599,15 @@ class PageRepo extends EntityRepo
 
     /**
      * Gets a suitable slug for the resource
-     * @param            $name
-     * @param            $bookId
+     * @param string $name
+     * @param int $bookId
      * @param bool|false $currentId
      * @return string
      */
     public function findSuitableSlug($name, $bookId, $currentId = false)
     {
         $slug = Str::slug($name);
+        if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5);
         while ($this->doesSlugExist($slug, $bookId, $currentId)) {
             $slug .= '-' . substr(md5(rand(1, 500)), 0, 3);
         }