protected function makeBlogPostSlug(string $title, string $year = '', string $month = '') : string { if (empty($year)) { $year = \date('Y'); } if (empty($month)) { $month = \date('m'); } $query = 'SELECT count(*) FROM view_hull_blog_list WHERE blogmonth = ? AND blogyear = ? AND slug = ?'; $slug = $base_slug = \Airship\slugFromTitle($title); $i = 1; while ($this->db->exists($query, $month, $year, $slug)) { $slug = $base_slug . '-' . ++$i; } return $slug; }