Variational analysis solves the maximization with respect to the function $q(t)$ of the functional depending on $q(t)$ and its derivative $$ J[q]=\int_a^b L(t,q(t),\dot{q}(t)) \ dt \qquad (1) $$
by finding the solution of the Euler-Lagrange equation
$$ L_y - \frac{\partial}{\partial t} L_{z} =0 $$
where $L_y, L_z$ indicate the partial derivatives of the functional $L(x,y,z)$ .
In the case of the functional depending on the function and its integral $\int_a^t q(v) dv$,
$$ J[q]=\int_a^b L\left( t,\int_a^t q(v) dv,q(t) \right) \ dt \qquad (2) $$
with the substitutions $u(t) = \int_a^t q(v) dv,\ \dot u (t) = q(t) $ we get the same equation. If the functional is
$$ J[q]=\int_a^b L\left( t,\int_a^t g(q(v)) dv,q(t) \right) \ dt \qquad (3) $$
(note the $g(\cdot)$ in the integral), it can be proven that the E-L equation is $$ L_y - \frac{\partial}{\partial t} \left( \frac{L_{z}}{\dot g(q)} \right) =0 $$
What if the functional contains more integrals, as in the case $$ J[q]=\int_a^b L\left( t,\int_a^t g(q(v)) dv,\int_a^t f(q(v)) dv,q(t) \right) \ dt \qquad (4) $$ What would it be the E-L equation?
Note that when using a test function $n(t)$ to obtain the E-L equation (evaluating $J[q+\epsilon \ n]$, etc), in (1) it is supposed $n(a)=n(b)=0$. The constraint to use in (2) is $\int_a^b n(v) dv=0$ and in (3)-(4) it is $\int_a^b \dot g(q(v)) n(v) dv=0$.