Error in paginate using inner join and distinct

First: Sorry My english.

Second:

I create a “select” with inner join, include a distinct to not see repeated items and paginate to page the items. The problem is that the paginate total comes in a different value than the actual amount. Follows code and evidence.

const newsbanner = await NewsBanner.query()
      .select('news_banners.*')
      .distinct()
      .innerJoin('news_banner_permission_groups', 'news_banners.id', 'news_banner_permission_groups.news_banner_id')
      .with("permissionGroup")
      .where(function() {
        data.active = data.active || "true";
        data.active === "false" ? this : this.where("active", true);
      })
      .where(function() {
        data.search = data.search || null;
        data.search === null ? this : this.where("title", "like", `%${data.search}%`);
      })
      .where(function() {
        this.whereIn('group', userGroups).orWhere("news_banners.type", 1)
      })
      .where(function(){
        this.whereRaw(`'${date}' BETWEEN initialDate AND finaldate`)
      })
      .paginate(data.page, data.perPage);

In the image I have a total of 27 items, but the second page no longer has any items.

My question is, am I doing something wrong or is it a framework bug?