<commit_before>package com.moesounds.controller;

import java.util.concurrent.ThreadLocalRandom;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.moesounds.annotation.DefaultController;
import com.moesounds.domain.Page;
import com.moesounds.service.MoeSoundsService;

@DefaultController
public class HomeController {

    @Autowired
    private MoeSoundsService moeSoundsService;

    @RequestMapping(value = {"/random", "/"})
    public ModelAndView getHomePage() {

        ModelAndView mav = new ModelAndView("home");

        Page randomPage = moeSoundsService.getRandomPage();
        int randomNumber = ThreadLocalRandom.current().nextInt(0, 1 + 1);

        mav.addObject("page", randomPage);
        mav.addObject("randomNumber", randomNumber);

        return mav;
    }

    @RequestMapping(value = {"/page/{pageId}"})
    public ModelAndView getSpecificPage(@PathVariable("pageId") int pageId) {

        ModelAndView mav = new ModelAndView("home");

        Page specificPage = moeSoundsService.getSpecificPage(pageId);
        mav.addObject("page", specificPage);

        return mav;
    }

}<commit_msg>Fixed random background not working on speicifc page requests<commit_after>package com.moesounds.controller;

import java.util.concurrent.ThreadLocalRandom;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.moesounds.annotation.DefaultController;
import com.moesounds.domain.Page;
import com.moesounds.service.MoeSoundsService;

@DefaultController
public class HomeController {

    @Autowired
    private MoeSoundsService moeSoundsService;

    @RequestMapping(value = {"/", "/random", "/page/{pageId}"})
    public ModelAndView getHomePage(@PathVariable(value = "pageId", required = false) Integer pageId) {

        ModelAndView mav = new ModelAndView("home");

        Page page = pageId == null ? moeSoundsService.getRandomPage() : moeSoundsService.getSpecificPage(pageId);;
        int randomNumber = ThreadLocalRandom.current().nextInt(0, 1 + 1);

        mav.addObject("page", page);
        mav.addObject("randomNumber", randomNumber);

        return mav;
    }

}
{'fraction_non_alphanumeric': 0.10764305722288915, 'fraction_numerical': 0.0024009603841536613, 'mean_word_length': 4.4945054945054945, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4619808', 'n_tokens_mistral': 723, 'n_tokens_neox': 695, 'n_words': 133}