# Weird problem with pdfpages and fbox

I'm trying to get a colored background for my page numbers, and it works okay - except when I want it to show on pdf pages (which is where it's most important). This also happens on the last page of text.

This is what it should look like:

This is what it looks like on the pdf pages:

MWE:

\documentclass[book,openeven,showtrims]{memoir}
% http://latex-my.blogspot.dk/2009/10/setting-page-size-and-margins.html
%% The stock paper size
\setstocksize{236mm}{161mm}

%% The 'real' page size
\settrimmedsize{230mm}{155mm}{*}

%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge
\settrims{3mm}{3mm}

%% Spine and trim page margins from main typeblock
\setlrmarginsandblock{20mm}{15mm}{*}

%% Top and bottom page margins from main typeblock
\setulmarginsandblock{20mm}{20mm}{*}

%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock

%% Bottom edge of header is 7mm from top edge of
%% typeblock
%\renewcommand\trimmarkscolor{\color{red}}
\trimLmarks
\checkandfixthelayout

\usepackage[xcdraw]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage{graphicx}
\usepackage{bookman} % font
\usepackage{lipsum}
\usepackage{pdfpages}

\makepagestyle{mm}
\setlength{\fboxrule}{6pt}%
\makeevenfoot{mm}{\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}{}{}
\makeoddfoot{mm}{}{}{\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}
\pagestyle{mm}

\begin{document}
\chapter{Test}
\lipsum[1-20]
\includepdf[noautoscale,pagecommand={},pages=-]{mwepdf}
\end{document}


You can get the dummy pdf here: http://kristian.anapnea.net/mwepdf.pdf

I hope someone know what's up here as it makes very little sense to me!

\makeevenfoot{mm}{\setlength{\fboxrule}{6pt}\setlength\fboxsep{2pt}\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}{}{}

pdfpages locally sets \fboxsep and \fboxrule to zero. And those settings are then used by the headers. Adding suitable values for this into the headers saves the day. It does not afect the rest as the headers are groups.