X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/42976ca48c8de04726e62356f76f0bbb77b2ab15..92d393537c9de537d03141d8630d46fbe890f575:/app/Repos/PageRepo.php diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.php index d3b71cebd..235246f82 100644 --- a/app/Repos/PageRepo.php +++ b/app/Repos/PageRepo.php @@ -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); }