<commit_before>using AutoMapper;
using CmsEngine.Data.AccessLayer;
using CmsEngine.Data.Models;
using CmsEngine.Data.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace CmsEngine.Ui.Controllers
{
    public class BaseController : Controller
    {
        protected readonly CmsService service;
        protected readonly InstanceViewModel instance;

        public BaseController(IUnitOfWork uow, IMapper mapper, IHttpContextAccessor hca, UserManager<ApplicationUser> userManager)
        {
            service = new CmsService(uow, mapper, hca, userManager);
            instance = service.Instance;
        }

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            base.OnActionExecuting(context);

            instance.PagedPosts = service.GetPostsReadOnly<PostViewModel>(4);
            instance.LatestPosts = service.GetPostsReadOnly<PostViewModel>(3);
            instance.Pages = service.GetAllPagesReadOnly<PageViewModel>();
            instance.Categories = service.GetCategoriesWithPostCount<CategoryViewModel>();
            instance.Tags = service.GetAllTagsReadOnly<TagViewModel>();
        }
    }
}<commit_msg>Changed calls, now loading only published posts<commit_after>using AutoMapper;
using CmsEngine.Data.AccessLayer;
using CmsEngine.Data.Models;
using CmsEngine.Data.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace CmsEngine.Ui.Controllers
{
    public class BaseController : Controller
    {
        protected readonly CmsService service;
        protected readonly InstanceViewModel instance;

        public BaseController(IUnitOfWork uow, IMapper mapper, IHttpContextAccessor hca, UserManager<ApplicationUser> userManager)
        {
            service = new CmsService(uow, mapper, hca, userManager);
            instance = service.Instance;
        }

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            base.OnActionExecuting(context);

            instance.PagedPosts = service.GetPostsByStatusReadOnly<PostViewModel>(DocumentStatus.Published, 4);
            instance.LatestPosts = service.GetPostsByStatusReadOnly<PostViewModel>(DocumentStatus.Published,3);
            instance.Pages = service.GetAllPagesReadOnly<PageViewModel>();
            instance.Categories = service.GetCategoriesWithPostCount<CategoryViewModel>();
            instance.Tags = service.GetAllTagsReadOnly<TagViewModel>();
        }
    }
}
{'fraction_non_alphanumeric': 0.07830648182840015, 'fraction_numerical': 0.0014986886474334957, 'mean_word_length': 3.6354166666666665, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4507074', 'n_tokens_mistral': 681, 'n_tokens_neox': 680, 'n_words': 133}