|
20 | 20 | namespace phpMyFAQ\Controller\Frontend; |
21 | 21 |
|
22 | 22 | use Exception; |
| 23 | +use League\CommonMark\Exception\CommonMarkException; |
23 | 24 | use phpMyFAQ\Filter; |
24 | 25 | use phpMyFAQ\Language\Plurals; |
25 | 26 | use phpMyFAQ\Search\SearchService; |
|
36 | 37 | final class SearchController extends AbstractFrontController |
37 | 38 | { |
38 | 39 | /** |
39 | | - * Displays search results for fulltext or tag-based search. |
| 40 | + * Redirects tag URLs with pagination to search |
| 41 | + * |
| 42 | + * @throws Exception |
| 43 | + */ |
| 44 | + #[Route(path: '/tags/{tagId}/{page}/{slug}.html', name: 'public.tags.paginated', methods: ['GET'])] |
| 45 | + public function tagsPaginated(Request $request): Response |
| 46 | + { |
| 47 | + $tagId = Filter::filterVar($request->attributes->get('tagId'), FILTER_VALIDATE_INT, 0); |
| 48 | + $page = Filter::filterVar($request->attributes->get('page'), FILTER_VALIDATE_INT, 1); |
| 49 | + |
| 50 | + return new RedirectResponse(sprintf('/search.html?tagging_id=%d&seite=%d', $tagId, $page)); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Redirects tag URLs to search |
40 | 55 | * |
41 | 56 | * @throws Exception |
42 | 57 | */ |
| 58 | + #[Route(path: '/tags/{tagId}/{slug}.html', name: 'public.tags', methods: ['GET'])] |
| 59 | + public function tags(Request $request): Response |
| 60 | + { |
| 61 | + $tagId = Filter::filterVar($request->attributes->get('tagId'), FILTER_VALIDATE_INT, 0); |
| 62 | + |
| 63 | + return new RedirectResponse(sprintf('/search.html?tagging_id=%d', $tagId)); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Displays search results for fulltext or tag-based search. |
| 68 | + * |
| 69 | + * @throws Exception|CommonMarkException |
| 70 | + */ |
43 | 71 | #[Route(path: '/search.html', name: 'public.search', methods: ['GET'])] |
44 | 72 | public function index(Request $request): Response |
45 | 73 | { |
|
0 commit comments