4. Find all integer pairs $(m, n)$ that satisfy $m^{2}=n^{5}+n^{4}+1$ and $m-7n$ divides $m-4n$.

Translate the text above into English, please keep the original text's line breaks and format, and output the translation result directly.
4. Notice that,
$$
n^{5}+n^{4}+1=\left(n^{3}-n+1\right)\left(n^{2}+n+1\right) \text {. }
$$

Let $d=\left(n^{3}-n+1, n^{2}+n+1\right)$
$$
\begin{array}{l}
=\left(n^{2}+n+1,-n^{2}-2 n+1\right) \\
=\left(n^{2}+n+1, n-2\right)=(n-2,7) .
\end{array}
$$

We consider two cases.
(1) $d=7$.

Then $7 \mid m, 7 \nmid n$
$$
\Rightarrow 7 \mid(m-7 n) \text { and } 7 \nmid(m-4 n) \text {, }
$$

which has no solution.
(2) $d=1$.
Notice that, when $n \geqslant 1$,
$$
n^{2}<n^{2}+n+1<(n+1)^{2} ;
$$

when $n<-1$,
$$
(n+1)^{2}<n^{2}+n+1<n^{2} \text {. }
$$

Thus, $n^{3}-n+1$ and $n^{2}+n+1$ are both perfect squares if and only if $n=0,-1$.
In this case, we have $m^{2}=1 \Rightarrow m= \pm 1$.
Upon verification, only $(m, n)=(-1,0),(1,0)$ satisfy the conditions.