Time component of momentum four-vector In Landau-Lifshitz, Classical theory of fields (second chapter), the four-momentum is defined by the equation
$$-\frac{\partial S}{\partial x^i}=p_i\tag{9.12},$$
where $S$ is the action integral. The time component for the four vector can be found out from the equation
$$p^i=mcu^i\tag{9.14},$$ 
and we get  $$\frac{E}{c}=\frac{mc}{\sqrt{1-\frac{v^2}{c^2}}}.\tag{9.4}$$
I tried to derive the same from the equation $(9.12)$ by taking $S=\int{L}{dt}$, where $L$ is the Lagrangian given as 
$$L=-mc^2\sqrt{1-\frac{v^2}{c^2}}\tag{8.2}.$$
On applying equation $(9.12)$ to find out the time component of momentum four vector, since $v$ is independent of time component in the Lagrangian, we get
$$\frac{E}{c}=p_0=-\frac{\partial S}{\partial x^0}=-\frac{\partial\int L\mathrm{d}t}{\partial (ct)}=-\frac{L}{c},$$
which is inconsistent. So could anyone please tell me where am I wrong?
 A: Don't dismiss OP's question offhand: We are actually not differentiating wrt. the integration/dummy variable $t$ (which indeed wouldn't make sense). Rather we're differentiating wrt. the upper final time $t_f$. In more detail$^1$
$$ {\bf p}_f\cdot{\bf v}_f-L_f
~=~  E_f~=~cp_f^0
~=~\mp cp^f_0
~\stackrel{(9.12)}{=}~ -c\frac{\partial S}{\partial x^0_f}$$
$$~=~ -\frac{\partial S}{\partial t_f}
~=~ -\frac{\partial \int_{t_i}^{t_f}\! dt ~L_|}{\partial t_f}
~\stackrel{\text{wrong}}{=}~-L_f~. $$
OP is essentially asking the following question.

Why we cannot use the fundamental theorem of calculus to deduce the last equality? 

We know it's wrong because it is missing the ${\bf p}_f\cdot{\bf v}_f$ term. The reason is because 
$$S(x_f,x_i)~=~-mc\sqrt{\mp (x_f\!-\!x_i)^2}$$ 
is the Dirichlet on-shell action function. Therefore the Lagrangian $$L_|~=~-mc^2\sqrt{1- \frac{({\bf x}_f\!-\!{\bf x}_i)^2}{c^2(t_f\!-\!t_i)^2}} $$ is evaluated (cf. the vertical bar $|$ in the notation) along a classical solution that has some $t_f$-dependence (because the classical solution depends on boundary conditions). For a correct derivation, see e.g.  my Phys.SE answers here & here.
References:


*

*L.D. Landau & E.M. Lifshitz, Vol.2, The Classical Theory of Fields, $\S$9.


--
$^1$ Conventions: We shall show both Minkowski sign conventions $(\mp, \pm, \pm, \pm)$ for reference/clarity.  Ref. 1 uses $(+, -, -, -)$. 
