<commit_before>﻿using System;
using System.Web.Mvc;

namespace TravelAlbum.Controllers
{
    public class CultureController : Controller
    {

        public RedirectToRouteResult RedirectLanguage(string language, string query)
        {
            var urlParts = query.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            if (urlParts.Length > 1 && (query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[1], action = urlParts[2] });
            }
            else if (urlParts.Length > 1 && !(query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[0], action = urlParts[1] });
            }
            else
            {
                return this.RedirectToRoute(new { lang = language, controller = "Home", action = "Index" });
            }

        }
    }
}<commit_msg>Redirecting cases for localization amended<commit_after>﻿using System;
using System.Web.Mvc;

namespace TravelAlbum.Controllers
{
    public class CultureController : Controller
    {

        public RedirectToRouteResult RedirectLanguage(string language, string query)
        {
            var urlParts = query.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            if (urlParts.Length == 2 && !(query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[0], action = urlParts[1] });
            }
            else if (urlParts.Length == 3 && (query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[1], action = urlParts[2] });
            }
            else if (urlParts.Length == 3 && !(query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[0], action = urlParts[1], id = urlParts[2] });
            }
            else if (urlParts.Length == 4 && (query.Contains("/bg/") || query.Contains("/en/")))
            {
                return this.RedirectToRoute(new { lang = language, controller = urlParts[1], action = urlParts[2], id = urlParts[3] });
            }
            else
            {
                return this.RedirectToRoute(new { lang = language, controller = "Home", action = "Index" });
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.14107073075420085, 'fraction_numerical': 0.007815552950371238, 'mean_word_length': 2.0917874396135265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1880675', 'n_tokens_mistral': 691, 'n_tokens_neox': 667, 'n_words': 150}